Skip to content

SaaS Metering (ConnectSoft.Saas.MeteringTemplate)

A Layer 3 SaaS microservice template for the Metering bounded context - tracks usage counters per tenant and dimension with quota threshold signaling. Aggregate root: UsageMeter. Topic prefix: metering.usage.v1.

It extends ConnectSoft.BaseTemplate via the base-template/ submodule + MSBuild layering. Shared behavior is covered by the Base Template and template layering; this section documents the Metering domain.

Responsibility

Maintains a current usage counter per (tenant, dimension) and signals quota thresholds. The Products Catalog declares usage limits; Metering enforces/counts them. It reacts to platform events (tenant activation, subscription creation, entitlements changes) to provision and quota meters.

Not a time-series store

Counter state is embedded in UsageMeterEntity; usage increments are command inputs (RecordUsageInput.Delta), not stored as time-series rows. docs/bounded-context.md mentions conceptual Counter/Window/UsageRecord - these are not separate persisted entities. Billing-grade rating/invoicing, a QuotaPolicy aggregate, and anomaly detection are out of scope.

External references (by id only)

  • TenantId -> Tenants
  • SubscriptionId -> Billing
  • Dimension -> Products Catalog (Feature)

dotnet new

dotnet new install ConnectSoft.Saas.MeteringTemplate.Installer
dotnet new connectsoft-saas-metering -n ConnectSoft.MyMeteringService

See also