Tenantry ProAPI reference
ITenantSeeder<TKey> interface
Namespace: Tenantry.Pro.Lifecycle · Package: Tenantry.Pro · API reference
Consumer-implemented interface for seeding initial data into a new tenant's database. Register an implementation in DI before calling ITenantLifecycleManager<TKey>.ProvisionAsync:
services.AddScoped<ITenantSeeder<Guid>, MyTenantSeeder>();public interface ITenantSeeder<TKey> where TKey : IEquatable<TKey>, IParsable<TKey>Type parameters
TKey: The tenant identifier type.
Methods
SeedAsync(ITenantDescriptor<TKey>, IServiceProvider, CancellationToken)
Seeds default data for the given tenant. Called within a DI scope where all scoped services (DbContext, repositories, etc.) are tenant-aware — the tenant context is already set.
Task SeedAsync(ITenantDescriptor<TKey> tenant, IServiceProvider scopedProvider, CancellationToken cancellationToken)Parameters:
tenantITenantDescriptor<TKey>: The tenant being provisioned.scopedProviderIServiceProvider: AnIServiceProviderscoped to this tenant. Resolve yourDbContextor other services from here.cancellationTokenCancellationToken: A cancellation token.
Returns: Task