Interface IDataContext
Composite facade over the individual context roles, kept as the convenient entry point for consumers. The roles are separate interfaces so that providers and collaborators can depend on the smallest surface they actually need:
- IQueryExecutor — terminal operators;
- IQueryMaterializer — planning + row reading;
- IQueryCache — plan cache;
- IContextEnvironment — loggers, mapping mode, property bag;
- IRawCommandExecutor — raw parameterised commands.
Connection management is deliberately not part of this composite (see IConnectionManager): the in-memory provider must not be forced to implement a no-op connection lifecycle.
public interface IDataContext : IQueryExecutor, IQueryMaterializer, IQueryPlanner, IRowReaderFactory, IQueryCache, IContextEnvironment, IRawCommandExecutor, IAsyncDisposable, IDisposable
- Inherited Members
- Extension Methods
Methods
GetPreparedQueryCommand<TResult>(QueryCommand<TResult>, bool, bool, PreparedCommandCache, CancellationToken)
Prepares queryCommand with an explicit command-reuse policy, optionally creating
the row enumerator and storing the plan in the cache.
IPreparedQueryCommand<TResult> GetPreparedQueryCommand<TResult>(QueryCommand<TResult> queryCommand, bool createEnumerator, bool storeInCache, PreparedCommandCache cache, CancellationToken cancellationToken)
Parameters
queryCommandQueryCommand<TResult>The command to prepare.
createEnumeratorboolWhen true, creates the row enumerator as part of preparation.
storeInCacheboolWhen true, the resulting plan may be stored in the plan cache.
cachePreparedCommandCacheThe policy that selects connection-scoped command reuse or a command per execution.
cancellationTokenCancellationTokenToken used to cancel preparation.
Returns
- IPreparedQueryCommand<TResult>
The prepared command, ready to execute.
Type Parameters
TResultThe projected result type.
Remarks
The default implementation supports only Connection and forwards to the policy-less overload. A context that does not implement the policy fails closed for any other value instead of silently substituting the connection policy.
Exceptions
- NotSupportedException
The context implementation does not implement the requested
cachepolicy.