Docs
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 TenantDescriptorExtensions

Methods

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, ITenantDescriptor

Type parameters:

Parameters:

Returns: TTenant: The same tenant, as TTenant.

Exceptions:

  • InvalidOperationException: The tenant is not a TTenant: the tenant store returns another type.
tenant.UseConnectionStrings(options =>
    options.GetConnectionString = t => t.As<AppTenant>().ConnectionString);

On this page