SchemaProvisioningServiceBase<TKey> class
Namespace: Tenantry.Pro.EfCore.Strategies.SchemaPerTenant · Package: Tenantry.Pro.EfCore · API reference
Provider-agnostic base for schema-per-tenant provisioning. Implements the shared pipeline (licence guard, schema-name resolution, tenant lookup, connection-string guard, logging) as a template method and defers the ADO.NET-specific CREATE SCHEMA to the provider subclass.
public abstract class SchemaProvisioningServiceBase<TKey> : ITenantInfrastructureProvisioner<TKey> where TKey : IEquatable<TKey>, IParsable<TKey>Type parameters
TKey: The tenant identifier type.
Implements ITenantInfrastructureProvisioner<TKey>.
Derived types: SchemaProvisioningService<TKey>, SchemaProvisioningService<TKey>.
Properties
Step
Identifies which lifecycle step this provisioner represents. Used by TenantProvisioningResult<TKey>.CompletedUpTo to record pipeline progress.
public TenantProvisioningStep Step { get; }Value: TenantProvisioningStep
Methods
CreateSchemaIfNotExistsAsync(string, string, CancellationToken)
Issues the provider-specific, idempotent CREATE SCHEMA against connectionString. Implementations are responsible for identifier escaping.
protected abstract Task CreateSchemaIfNotExistsAsync(string connectionString, string schemaName, CancellationToken cancellationToken)Parameters:
connectionStringstring: A connection string for the shared database.schemaNamestring: The name of the tenant's schema, unescaped.cancellationTokenCancellationToken: Cancels the operation.
Returns: Task
ProvisionAsync(TKey, CancellationToken)
Creates the schema for tenantId if it does not already exist.
public Task ProvisionAsync(TKey tenantId, CancellationToken cancellationToken = default)Parameters:
tenantIdTKey: The tenant to provision.cancellationTokenCancellationToken: A cancellation token.
Returns: Task
Exceptions:
LicenseRequiredException: The licence key is missing or invalid.