Table of Contents

Class BaseTypeParser<T>

Namespace
Rinku.Mapping.Parsers
Assembly
Rinku.dll

Base class for a custom result shape. Implement Parse(DbDataReader) and Default() then use the inherited query methods to run commands with that shape.

public abstract class BaseTypeParser<T> : ITypeParser<T>, ITypeParser, IDisposable

Type Parameters

T
Inheritance
BaseTypeParser<T>
Implements
Derived
Inherited Members
Extension Methods

Properties

Behavior

The reader behavior this parser wants, passed to ExecuteReader(CommandBehavior).

public abstract CommandBehavior Behavior { get; }

Property Value

CommandBehavior

Remarks

Methods

CanParse(ColumnInfo[])

Whether this parser can read a result carrying schema.

public abstract bool CanParse(ColumnInfo[] schema)

Parameters

schema ColumnInfo[]

Returns

bool

Remarks

A parser may accept several schemas. A parser that reads names and types at each call may accept every schema.

Default()

The value to return when the result has no row, an empty collection or optional, for instance.

public abstract T Default()

Returns

T

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public virtual void Dispose()

Parse(DbDataReader)

Parses one T starting at the current row, advancing the reader as it goes. CanContinue reports the state of the reader on return, true when it is positioned on an untreated row, false when no row is left

public abstract (bool CanContinue, T Result) Parse(DbDataReader reader)

Parameters

reader DbDataReader

Returns

(bool CanContinue, T Result)

ParseAsync(DbDataReader, CancellationToken)

Parses one T starting at the current row, advancing the reader as it goes. CanContinue reports the state of the reader on return, true when it is positioned on an untreated row, false when no row is left

public abstract ValueTask<(bool CanContinue, T Result)> ParseAsync(DbDataReader reader, CancellationToken ct = default)

Parameters

reader DbDataReader
ct CancellationToken

Returns

ValueTask<(bool CanContinue, T Result)>

Query(DbCommand, ICache, bool)

Runs command and reads its result as T, also letting cache learn from the executed command.

public T Query(DbCommand command, ICache cache, bool disposeCommand = false)

Parameters

command DbCommand
cache ICache
disposeCommand bool

Returns

T

Query(DbCommand, bool)

Runs command and reads its result as T, disposing the command afterward when disposeCommand is set.

public T Query(DbCommand command, bool disposeCommand = false)

Parameters

command DbCommand
disposeCommand bool

Returns

T

Query(IDbCommand, ICache, bool)

Runs command and reads its result as T, also letting cache learn from the executed command.

public T Query(IDbCommand command, ICache cache, bool disposeCommand = false)

Parameters

command IDbCommand
cache ICache
disposeCommand bool

Returns

T

Query(IDbCommand, bool)

Runs command and reads its result as T, disposing the command afterward when disposeCommand is set.

public T Query(IDbCommand command, bool disposeCommand = false)

Parameters

command 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 command, ICache cache, bool disposeCommand = false, CancellationToken ct = default)

Parameters

command DbCommand
cache ICache
disposeCommand bool
ct CancellationToken

Returns

Task<T>

QueryAsync(DbCommand, bool, CancellationToken)

Runs command and reads its result as T, disposing the command afterward when disposeCommand is set.

public Task<T> QueryAsync(DbCommand command, bool disposeCommand = false, CancellationToken ct = default)

Parameters

command DbCommand
disposeCommand bool
ct CancellationToken

Returns

Task<T>

QueryAsync(IDbCommand, ICache, bool, CancellationToken)

Runs command and reads its result as T, also letting cache learn from the executed command.

public Task<T> QueryAsync(IDbCommand command, ICache cache, bool disposeCommand = false, CancellationToken ct = default)

Parameters

command IDbCommand
cache ICache
disposeCommand bool
ct CancellationToken

Returns

Task<T>

QueryAsync(IDbCommand, bool, CancellationToken)

Runs command and reads its result as T, disposing the command afterward when disposeCommand is set.

public Task<T> QueryAsync(IDbCommand command, bool disposeCommand = false, CancellationToken ct = default)

Parameters

command IDbCommand
disposeCommand bool
ct CancellationToken

Returns

Task<T>