Tenantry CoreAPI reference
TenantDescriptorExtensions class
Namespace: Tenantry · Package: Tenantry.Core · API reference
Reads a tenant as the application's own tenant type.
public static class TenantDescriptorExtensionsMethods
As<TTenant>(ITenantDescriptor)
Returns tenant as TTenant, the type your tenant store returns, so a delegate that receives an ITenantDescriptor<TKey> can read your tenant's own properties.
public static TTenant As<TTenant>(this ITenantDescriptor tenant) where TTenant : class, ITenantDescriptorType parameters:
TTenant: Your tenant type, which implementsITenantDescriptor<TKey>.
Parameters:
tenantITenantDescriptor: A tenant from your tenant store.
Returns: TTenant: The same tenant, as TTenant.
Exceptions:
InvalidOperationException: The tenant is not aTTenant: the tenant store returns another type.
tenant.UseConnectionStrings(options =>
options.GetConnectionString = t => t.As<AppTenant>().ConnectionString);