Docs
Tenantry CoreAPI reference

ITenantBuilder<TKey> interface

Namespace: Tenantry · Package: Tenantry.Core · API reference

The builder AddTenantry<TKey> passes to its configuration callback. Tenantry's features are extension methods on it that return it, so calls chain.

public interface ITenantBuilder<TKey> : ITenantBuilder where TKey : IEquatable<TKey>, IParsable<TKey>

Type parameters

  • TKey: The tenant identifier type. Must implement IEquatable<T> and IParsable<TSelf>.

Methods

UseStore<TStore>()

Registers a custom ITenantStore<TKey> implementation.

ITenantBuilder<TKey> UseStore<TStore>() where TStore : class, ITenantStore<TKey>

Type parameters:

  • TStore: The store type, created through dependency injection.

Returns: ITenantBuilder<TKey>

Exceptions:

  • InvalidOperationException: A tenant store is already registered.

The store is registered with a scoped lifetime and is resolved per operation — Tenantry creates a fresh scope for singleton/background callers — so the implementation may safely depend on scoped services such as a DbContext.

On this page