Property Shared
- Namespace
- QueryGuard
- Assembly
- QueryGuard.Core.dll
Shared
The process-wide accessor used when no other one is supplied.
public static AsyncLocalQueryGuardSessionAccessor Shared { get; }
Property Value
Remarks
A scope and the interceptor that feeds it have to read the same accessor, and getting
that wrong fails in the least helpful way available: the scope completes with zero commands, so
every count assertion fails for a reason that has nothing to do with the code under test. This
default exists so the common case cannot be wired wrong: UseQueryGuard() and
QueryGuardScope.Start both land here unless told otherwise.
It is static, which sounds alarming for something on a concurrent path and is not: the accessor holds no session itself. Every session reference lives in an AsyncLocal<T> slot belonging to one logical flow, so two parallel tests sharing this instance still cannot see each other's commands. The session-isolation stress suites run against exactly this arrangement.
An application that resolves QueryGuard from a container gets that container's accessor instead, and should not mix the two.