Table of Contents

Interface ITypeParserMaker

Namespace
Rinku.Mapping
Assembly
Rinku.dll

Creates parsers for custom result types. Add a maker to TypeParserMakers before the default makers.

public interface ITypeParserMaker
Extension Methods

Methods

CanHandle<T>()

Whether this maker claims T.

bool CanHandle<T>()

Returns

bool

Type Parameters

T

TryColdStart(Type, DbCommand, ICacheGivingParser, bool, out object?)

Tries to run T before the returned columns are known. Return false when a parser must be created after the reader opens.

bool TryColdStart(Type type, DbCommand cmd, ICacheGivingParser cache, bool disposeCommand, out object? result)

Parameters

type Type
cmd DbCommand

The command to run, not yet run.

cache ICacheGivingParser

Turns the reader's columns into the parser for T.

disposeCommand bool

Whether the command is this run's to dispose.

result object

The result, when this maker took the run.

Returns

bool

Remarks

Use this for a deferred result that must open the reader while it is consumed. Return false for buffered results or when the columns must be known first.

TryColdStart(Type, IDbCommand, ICacheGivingParser, bool, out object?)

Tries to run T before the returned columns are known. Return false when a parser must be created after the reader opens.

bool TryColdStart(Type type, IDbCommand cmd, ICacheGivingParser cache, bool disposeCommand, out object? result)

Parameters

type Type
cmd IDbCommand

The command to run, not yet run.

cache ICacheGivingParser

Turns the reader's columns into the parser for T.

disposeCommand bool

Whether the command is this run's to dispose.

result object

The result, when this maker took the run.

Returns

bool

Remarks

Use this for a deferred result that must open the reader while it is consumed. Return false for buffered results or when the columns must be known first.

TryColdStartAsync(Type, DbCommand, ICacheGivingParser, bool, CancellationToken, out Task<object?>?)

Attempts to produce a deferred object result for a runtime result type.

bool TryColdStartAsync(Type type, DbCommand cmd, ICacheGivingParser cache, bool disposeCommand, CancellationToken ct, out Task<object?>? result)

Parameters

type Type
cmd DbCommand
cache ICacheGivingParser
disposeCommand bool
ct CancellationToken
result Task<object>

Returns

bool

TryColdStartAsync(Type, IDbCommand, ICacheGivingParser, bool, CancellationToken, out Task<object?>?)

Attempts to produce a deferred object result for a runtime result type.

bool TryColdStartAsync(Type type, IDbCommand cmd, ICacheGivingParser cache, bool disposeCommand, CancellationToken ct, out Task<object?>? result)

Parameters

type Type
cmd IDbCommand
cache ICacheGivingParser
disposeCommand bool
ct CancellationToken
result Task<object>

Returns

bool

TryColdStartAsync<T>(DbCommand, ICacheGivingParser<T>, bool, CancellationToken, out Task<T>)

bool TryColdStartAsync<T>(DbCommand cmd, ICacheGivingParser<T> cache, bool disposeCommand, CancellationToken ct, out Task<T> result)

Parameters

cmd DbCommand

The command to run, not yet run.

cache ICacheGivingParser<T>

Turns the reader's columns into the parser for T.

disposeCommand bool

Whether the command is this run's to dispose.

ct CancellationToken

The token the caller is running under.

result Task<T>

The result, when this maker took the run.

Returns

bool

Type Parameters

T

Remarks

Return a completed task when no asynchronous work is needed. The synchronous and asynchronous methods may accept different result types.

TryColdStartAsync<T>(IDbCommand, ICacheGivingParser<T>, bool, CancellationToken, out Task<T>)

bool TryColdStartAsync<T>(IDbCommand cmd, ICacheGivingParser<T> cache, bool disposeCommand, CancellationToken ct, out Task<T> result)

Parameters

cmd IDbCommand

The command to run, not yet run.

cache ICacheGivingParser<T>

Turns the reader's columns into the parser for T.

disposeCommand bool

Whether the command is this run's to dispose.

ct CancellationToken

The token the caller is running under.

result Task<T>

The result, when this maker took the run.

Returns

bool

Type Parameters

T

Remarks

Return a completed task when no asynchronous work is needed. The synchronous and asynchronous methods may accept different result types.

TryColdStart<T>(DbCommand, ICacheGivingParser<T>, bool, out T)

Tries to run T before the returned columns are known. Return false when a parser must be created after the reader opens.

bool TryColdStart<T>(DbCommand cmd, ICacheGivingParser<T> cache, bool disposeCommand, out T result)

Parameters

cmd DbCommand

The command to run, not yet run.

cache ICacheGivingParser<T>

Turns the reader's columns into the parser for T.

disposeCommand bool

Whether the command is this run's to dispose.

result T

The result, when this maker took the run.

Returns

bool

Type Parameters

T

Remarks

Use this for a deferred result that must open the reader while it is consumed. Return false for buffered results or when the columns must be known first.

TryColdStart<T>(IDbCommand, ICacheGivingParser<T>, bool, out T)

Tries to run T before the returned columns are known. Return false when a parser must be created after the reader opens.

bool TryColdStart<T>(IDbCommand cmd, ICacheGivingParser<T> cache, bool disposeCommand, out T result)

Parameters

cmd IDbCommand

The command to run, not yet run.

cache ICacheGivingParser<T>

Turns the reader's columns into the parser for T.

disposeCommand bool

Whether the command is this run's to dispose.

result T

The result, when this maker took the run.

Returns

bool

Type Parameters

T

Remarks

Use this for a deferred result that must open the reader while it is consumed. Return false for buffered results or when the columns must be known first.

TryMakeParser<T>(INullColHandler, ColumnInfo[], out ITypeParser<T>)

Builds the parser for T over the given columns, or returns false to decline.

bool TryMakeParser<T>(INullColHandler nullColHandler, ColumnInfo[] cols, out ITypeParser<T> parser)

Parameters

nullColHandler INullColHandler
cols ColumnInfo[]
parser ITypeParser<T>

Returns

bool

Type Parameters

T

Remarks

nullColHandler is the requested root nullability. It is GetDefaultNullColHandler<T>() (the type's own nullability) unless a caller replaced it. The method must accept any INullColHandler.