Table of Contents

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

CommandBehavior

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

bool

true when a parser was removed.

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

cmd DbCommand
cache ICache
disposeCommand bool

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

cmd DbCommand
disposeCommand bool

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

cmd IDbCommand
cache ICache
disposeCommand bool

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

cmd IDbCommand
disposeCommand bool

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

cmd DbCommand
cache ICache
disposeCommand bool
ct CancellationToken

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

cmd DbCommand
disposeCommand bool
ct CancellationToken

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

cmd IDbCommand
cache ICache
disposeCommand bool
ct CancellationToken

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

cmd IDbCommand
disposeCommand bool
ct CancellationToken

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

cmd DbCommand
disposeCommand bool
ct CancellationToken

Returns

IAsyncEnumerable<T>

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

cmd IDbCommand
reader DbDataReader

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

cmd IDbCommand
reader DbDataReader
ct CancellationToken

Returns

ValueTask<ITypeParser<T>>