Method CreateRedbScope(IRouteContext, string?)
Opens a scope with its own , for code that runs without an exchange and may run in
parallel: an observer, a background job, a store call made outside a route step. Every call opens a new scope,
so parallel callers never share a connection. The caller owns the scope and disposes it (await using).
Named (name set): the scope factory a host published for the name (Tsak does, one
per named instance), otherwise a scope opened from the instance registered with
(). Default (no name): a scope opened
from the service registered on the context, otherwise a scope of the context's service provider.
A service built without a DI container has no scope to open: the call throws
instead of handing out the shared instance, which is exactly the
contention this method exists to avoid. Single-threaded start-up code (scheme sync, seeding) keeps using
without an exchange.
A scope opened inside an ambient transaction takes part in it. Work that must survive the route's rollback
(an audit record, a budget counter) opens its scope under a suppressing TransactionScope.
public static RedbScope CreateRedbScope(this IRouteContext context, string? name = null)