Tenantry CoreAPI reference
MissingTenantBehavior enum
Namespace: Tenantry.Core · Package: Tenantry.Core · API reference
Policy for what happens when a tenant-scoped operation runs without a resolved tenant context. Shared across EF Core write isolation and background-job tenant propagation so the behaviour is configured with a single vocabulary.
public enum MissingTenantBehaviorValues
| Value | Description |
|---|---|
Allow = 0 | Proceed without a tenant, silently. EF Core writes are saved without a stamped TenantId; a background job runs without a tenant scope. |
Warn = 1 | Proceed without a tenant, but log a structured warning. The default — surfaces endpoints, jobs, or middleware ordering that bypassed tenant resolution without failing the operation. |
Reject = 2 | Fail the operation. EF Core writes throw TenantNotResolvedException before anything is persisted; a background job throws and is left to the host's retry/error handling. |
Skip = 3 | Abandon the operation without raising an error. Intended for background-job propagation, where it means "acknowledge and drop the message/job without running the handler". For EF Core write isolation there is nothing to abandon, so this behaves like MissingTenantBehavior.Allow (the save proceeds without a stamped tenant). |
ITenantStoreAccessor<TKey> interface
Reads tenants from the registered ITenantStore<TKey>tenantry-core-itenantstore.md on behalf of singletons, such as hosted services, resolving the store from a fresh dependency-injection scope for each call.
TenantConnectionStringOptions<TKey> class
How to find each tenant's connection string, for applications that give tenants their own database or route them to different servers.