Class CachedTypeParser<T>
- Namespace
- Rinku
- Assembly
- Rinku.dll
Reads T from database commands created by the caller.
Keep one instance and reuse it when those commands return compatible columns.
The instance can be shared across threads.
public sealed class CachedTypeParser<T> : ICacheGivingParser<T>, ICacheGivingParser, IDisposable
Type Parameters
T
- Inheritance
-
CachedTypeParser<T>
- Implements
- Inherited Members
- Extension Methods
Properties
Behavior
Reads query rows as T. Implement one to add a result shape that can be requested
through Query<T>.
public CommandBehavior Behavior { get; }
Property Value
Methods
Dispose()
Stops this instance from receiving parser invalidation notices and releases its parser.
public void Dispose()
Invalidate()
Forgets the parser held by this instance.
public bool Invalidate()
Returns
Query(DbCommand, ICache, bool)
Reads query rows as T. Implement one to add a result shape that can be requested
through Query<T>.
public T Query(DbCommand cmd, ICache cache, bool disposeCommand = false)
Parameters
Returns
- T
Query(DbCommand, bool)
Reads query rows as T. Implement one to add a result shape that can be requested
through Query<T>.
public T Query(DbCommand cmd, bool disposeCommand = false)
Parameters
Returns
- T
Query(IDbCommand, ICache, bool)
Reads query rows as T. Implement one to add a result shape that can be requested
through Query<T>.
public T Query(IDbCommand cmd, ICache cache, bool disposeCommand = false)
Parameters
cmdIDbCommandcacheICachedisposeCommandbool
Returns
- T
Query(IDbCommand, bool)
Reads query rows as T. Implement one to add a result shape that can be requested
through Query<T>.
public T Query(IDbCommand cmd, bool disposeCommand = false)
Parameters
cmdIDbCommanddisposeCommandbool
Returns
- T
QueryAsync(DbCommand, ICache, bool, CancellationToken)
Runs command and reads its result as T, also letting cache learn from the executed command.
public Task<T> QueryAsync(DbCommand cmd, ICache cache, bool disposeCommand = false, CancellationToken ct = default)
Parameters
cmdDbCommandcacheICachedisposeCommandboolctCancellationToken
Returns
- Task<T>
QueryAsync(DbCommand, bool, CancellationToken)
Reads query rows as T. Implement one to add a result shape that can be requested
through Query<T>.
public Task<T> QueryAsync(DbCommand cmd, bool disposeCommand = false, CancellationToken ct = default)
Parameters
cmdDbCommanddisposeCommandboolctCancellationToken
Returns
- Task<T>
QueryAsync(IDbCommand, ICache, bool, CancellationToken)
Reads query rows as T. Implement one to add a result shape that can be requested
through Query<T>.
public Task<T> QueryAsync(IDbCommand cmd, ICache cache, bool disposeCommand = false, CancellationToken ct = default)
Parameters
cmdIDbCommandcacheICachedisposeCommandboolctCancellationToken
Returns
- Task<T>
QueryAsync(IDbCommand, bool, CancellationToken)
Reads query rows as T. Implement one to add a result shape that can be requested
through Query<T>.
public Task<T> QueryAsync(IDbCommand cmd, bool disposeCommand = false, CancellationToken ct = default)
Parameters
cmdIDbCommanddisposeCommandboolctCancellationToken
Returns
- Task<T>
StreamQueryAsync(DbCommand, bool, CancellationToken)
Streams rows from cmd as T.
Use the row type for T rather than a collection type.
public IAsyncEnumerable<T> StreamQueryAsync(DbCommand cmd, bool disposeCommand = false, CancellationToken ct = default)
Parameters
cmdDbCommanddisposeCommandboolctCancellationToken
Returns
UpdateCache(IDbCommand, DbDataReader)
Builds the parser for the reader's columns and records what the run taught about the command.
public ITypeParser<T> UpdateCache(IDbCommand cmd, DbDataReader reader)
Parameters
cmdIDbCommandreaderDbDataReader
Returns
- ITypeParser<T>
UpdateCacheAsync(IDbCommand, DbDataReader, CancellationToken)
Builds the parser for the reader's columns and records what the run taught about the command.
public ValueTask<ITypeParser<T>> UpdateCacheAsync(IDbCommand cmd, DbDataReader reader, CancellationToken ct = default)
Parameters
cmdIDbCommandreaderDbDataReaderctCancellationToken
Returns
- ValueTask<ITypeParser<T>>