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

Methods

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 in AddTenantry.

Parameters:

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");
    });
});

On this page