ITenantLifecycleManager<TKey> interface
Namespace: Tenantry.Pro.Lifecycle · Package: Tenantry.Pro · API reference
Orchestrates the full tenant creation lifecycle: provision → migrate → seed.
Each step is only executed when the corresponding service is registered in DI:
-
Infrastructure provisioning: requires
AddDatabaseProvisioning()orAddSchemaProvisioning(). -
Migrations: requires
WithMigrationOrchestration(). -
Seeding: requires a registered
ITenantSeeder<TKey>.Any unregistered step is silently skipped.
The manager does not persist the tenant to the store — that is the caller's responsibility before invoking ITenantLifecycleManager<TKey>.ProvisionAsync.
public interface ITenantLifecycleManager<TKey> where TKey : IEquatable<TKey>, IParsable<TKey>Type parameters
TKey: The tenant identifier type.
Methods
ProvisionAsync(ITenantDescriptor<TKey>, CancellationToken)
Runs the full provisioning pipeline for the given tenant and returns the outcome.
Task<TenantProvisioningResult<TKey>> ProvisionAsync(ITenantDescriptor<TKey> tenant, CancellationToken cancellationToken = default)Parameters:
tenantITenantDescriptor<TKey>: The tenant descriptor. The consumer must have already persisted this to their store before calling this method.cancellationTokenCancellationToken: A cancellation token.
Returns: Task<TenantProvisioningResult<TKey>>: A TenantProvisioningResult<TKey> describing which steps succeeded or failed. A step that fails is captured in the result rather than thrown.
Exceptions:
LicenseRequiredException: Thrown before the pipeline starts if the licence key is missing or invalid.OperationCanceledException:cancellationTokenwas cancelled. The pipeline stops at once and steps that already completed are not undone.