TTenantProvisioner.AddTenant Method
Creates the tenant if it does not exist yet and returns its catalog record.
Remarks
The tenant is created with status Pending. If its shard has no catalog record, OnProvisionShard is invoked. Then OnProvisionTenant runs inside a TTenantScope for the new tenant (seed data, run application steps), and on success the tenant becomes Active (unless ActivateOnProvision is False).
If provisioning fails the tenant stays Pending and the exception propagates; calling AddTenant again for the same id resumes provisioning.
An already active tenant is simply returned. Raises EShardUnavailable when the allocator finds no shard.
Syntax
Unit: Aurelius.Tenancy.Provisioning
function TTenantProvisioner.AddTenant(const TenantId: string; const DisplayName: string; const AShardId: string): TTenantInfo;
Parameters
| <-> | Parameter | Type | Description |
|---|---|---|---|
| const | TenantId | string | The unique id of the tenant. |
| const | DisplayName | string | Optional human-readable name of the tenant. |
| const | AShardId | string | Optional shard id. When empty, the Allocator picks a shard among the active ones. |
Returns
The catalog record of the tenant.