MssqlQueryContext<TRow> class

Everything a terminal needs to execute a query against one table: the session, the binding, the clock, the dialect and the observer.

The context is long-lived — a generated db.orders getter is cached, so its context outlives any one query. What must not outlive one operation is the scope resolution, because a tenant factory reads ambient state: each terminal calls scopeCompiler once and threads that MssqlScopeCompiler through every statement it runs, so page and its count, and a read and its includes, cannot see two different tenants across an await. The dialect is cached, in a shared MssqlCapabilityCache, because the server's version does not change under the application.

Annotations
  • @immutable

Constructors

MssqlQueryContext({required MssqlSession session, required MssqlTableBinding<TRow> binding, MssqlDialect? dialect, MssqlClock clock = MssqlClock.serverUtc, MssqlChangeHub? changes, MssqlCapabilityCache? capabilities, MssqlQueryObserver? observer, MssqlObserverOptions observerOptions = const MssqlObserverOptions()})

Properties

binding MssqlTableBinding<TRow>
final
capabilities MssqlCapabilityCache?
Shared dialect resolution for this database, or the process-wide cache.
final
changes MssqlChangeHub?
Committed-write hub for MssqlWatchStrategy.localWrites, or null when this context was not created by an MssqlAppDatabase.
final
clock MssqlClock
final
dialect MssqlDialect
final
fixedDialect MssqlDialect?
The dialect this context was pinned to, or null when it asks the server.
no setter
hashCode int
The hash code for this object.
no setterinherited
observer MssqlQueryObserver?
Optional ORM-level observer for compile / mapping / relation-load.
final
observerOptions MssqlObserverOptions
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
session → MssqlSession
final

Methods

baseQuery(MssqlScopeSelection selection, {MssqlScopeCompiler? scopes}) MssqlQuery
The base SELECT for this table, with scope conditions applied.
globalScopedQuery(MssqlScopeSelection selection, {MssqlScopeCompiler? scopes}) MssqlQuery
Global-scope-only query (no soft-delete filter), for forceDelete, restore and _softDelete.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resolveDialect() Future<MssqlDialect>
The dialect of the current database, asking the server at most once.
scopeCompiler(MssqlScopeSelection selection) MssqlScopeCompiler
A fresh scope snapshot for this context's binding.
scopedQuery(MssqlScopeSelection selection, {MssqlScopeCompiler? scopes}) MssqlQuery
A SELECT with no projection, only scope conditions — for exists and count, which do not need the full column list.
toString() String
A string representation of this object.
inherited
withSession(MssqlSession session) MssqlQueryContext<TRow>
The same context on session, so a snapshot transaction can run the page and its count without rebuilding bindings.

Operators

operator ==(Object other) bool
The equality operator.
inherited