Tenantry ProAPI reference
ProServiceCollectionExtensions class
Namespace: Tenantry.Pro · Package: Tenantry.Pro · API reference
Extension methods for enabling Tenantry.Pro features on ITenantBuilder<TKey>.
public static class ProServiceCollectionExtensionsMethods
UsePro<TKey>(ITenantBuilder<TKey>, Action<ProBuilder<TKey>>)
Enables Tenantry.Pro features: database-per-tenant, schema-per-tenant, and offline licence validation.
public static ITenantBuilder<TKey> UsePro<TKey>(this ITenantBuilder<TKey> builder, Action<ProBuilder<TKey>> configure) where TKey : IEquatable<TKey>, IParsable<TKey>Type parameters:
TKey: The tenant identifier type. Must match the key type used inAddTenantry.
Parameters:
builderITenantBuilder<TKey>: The tenant builder obtained fromAddTenantry.configureAction<ProBuilder<TKey>>: A delegate for configuring Pro features viaProBuilder<TKey>.
Returns: ITenantBuilder<TKey>: The same builder for chaining.
builder.Services.AddTenantry<string>(tenant =>
{
tenant.ResolveFromHeader("X-Tenant-Id");
tenant.UseStore<MyTenantStore>();
tenant.UsePro(pro =>
{
pro.WithLicence(config["Tenantry:Licence"]!);
pro.UseDatabasePerTenant(opts =>
opts.GetConnectionString = tenant => $"Server=.;Database=myapp_{tenant.TenantId};Integrated Security=true");
});
});