Table of Contents

TDbTenantCatalog Class

Default ITenantCatalog implementation that stores tenants, shards and identifiers in a database, using the Aurelius entities declared in Aurelius.Tenancy.Catalog.Entities.

Remarks

The catalog tables belong to their own mapping model (Biz.TenantCatalog), so they can live in any database, including a dedicated catalog database or one of the shard databases. Call UpdateSchema once to create or update the tables. Every method takes a connection from the pool and uses its own TObjectManager, so the catalog can be shared between threads. The catalog stores only routing information; the connection settings of the shard databases stay in the application.

Syntax

Unit: Aurelius.Tenancy.Catalog.Db

TDbTenantCatalog = class(TCustomTenantCatalog);

Constructors

Name Description
Create Creates a new TDbTenantCatalog over the given connection pool.

Methods

Name Description
FindShard Returns the catalog record of a shard.
FindTenant Returns the catalog record of a tenant.
FindTenantBy​Identifier Returns the tenant associated with an external identifier.
GetShards Returns all registered shards, ordered by shard id.
RemoveIdentifier Removes an external identifier. Nothing happens if the identifier is unknown.
SaveIdentifier Associates an external identifier with a tenant, replacing any previous association of the same identifier.
SaveShard Creates or updates a shard record.
SaveTenant Creates or updates a tenant record.
UpdateSchema Creates or updates the catalog tables in the catalog database.