Docs
Tenantry ProAPI reference

MixedStrategyResolver<TKey> class

Namespace: Tenantry.Pro.Strategies.MixedMode · Package: Tenantry.Pro · API reference

Resolves the connection string or schema name for the tenant currently in scope, delegating to the appropriate underlying resolver based on the tenant's assigned strategy.

public sealed class MixedStrategyResolver<TKey> where TKey : IEquatable<TKey>, IParsable<TKey>

Type parameters

  • TKey: The tenant identifier type.

Constructors

MixedStrategyResolver(ITenantContext<TKey>, IOptions<MixedModeOptions<TKey>>, IServiceProvider)

Resolves the connection string or schema name for the tenant currently in scope, delegating to the appropriate underlying resolver based on the tenant's assigned strategy.

public MixedStrategyResolver(ITenantContext<TKey> tenantContext, IOptions<MixedModeOptions<TKey>> options, IServiceProvider serviceProvider)

Parameters:

  • tenantContext ITenantContext<TKey>: Supplies the current tenant.
  • options IOptions<MixedModeOptions<TKey>>: The mixed-mode options, which choose each tenant's strategy.
  • serviceProvider IServiceProvider: Resolves the chosen strategy's services.

Methods

GetCurrentStrategy()

Returns the TenantStrategy for the tenant currently in scope.

public TenantStrategy GetCurrentStrategy()

Returns: TenantStrategy

Exceptions:

ResolveConnectionString()

Returns the connection string for the current tenant, or null when the strategy is TenantStrategy.Shared or TenantStrategy.Schema.

public string? ResolveConnectionString()

Returns: string

Exceptions:

ResolveSchemaName()

Returns the schema name for the current tenant, or null when the strategy is TenantStrategy.Shared or TenantStrategy.Database.

public string? ResolveSchemaName()

Returns: string

Exceptions:

On this page