Interface IAmbientTenantStoreResolver<TStore>
Resolves the store instance for the current ambient tenant, bridging the ambient ITenantContext to the tenant-keyed ITenantStoreResolver<TStore>.
public interface IAmbientTenantStoreResolver<out TStore>
Type Parameters
TStoreThe store abstraction type (e.g.,
IEventStore,IProjectionStore<T>).
Remarks
This is the ambient-context bridge over the existing sharding seam: subsystems consume the current tenant's store without threading a tenant identifier by hand. The tenant term is read through FromContext(ITenantContext), so a context that has resolved no tenant fails closed rather than resolving to some store: there is no unresolved tenant term to route with, and routing one anyway would hand the caller a store belonging to whichever tenant the shard map happened to answer with.
A caller that genuinely belongs to no tenant says so with a value rather than by leaving the tenant unset: supply UntenantedContext, whose tenant term is the reserved untenanted partition and routes like any other key. An operation that spans every tenant is not expressible here at all — this contract resolves one tenant's store, so drive such an operation per tenant, or through a store method that is estate-wide by name.
Once a tenant term exists, routing, fail-fast, and default-shard behavior remain the existing ITenantStoreResolver<TStore>/ITenantShardMap seam's (a TenantShardNotFoundException surfaces when the tenant cannot be routed and no default shard is configured).
Methods
ResolveCurrent()
Resolves the store instance routed to the current ambient tenant's shard.
TStore ResolveCurrent()
Returns
- TStore
The store instance for the ambient tenant.
Exceptions
- TenantRequiredException
Thrown when the ambient context has resolved no tenant. The call is refused rather than routed with a substituted tenant term.
- TenantShardNotFoundException
Thrown when the ambient tenant cannot be resolved to a shard and no default shard is configured.