Class EnumerableTypeParserMaker
Creates parsers for IEnumerable<T> results. The returned sequence runs the query as it is enumerated. An asynchronous query opens the reader asynchronously before returning the sequence. Use an asynchronous stream when every row must be read asynchronously.
public sealed class EnumerableTypeParserMaker : ReusingBaseTypeParserMaker, ITypeParserMaker
- Inheritance
-
EnumerableTypeParserMaker
- Implements
- Inherited Members
- Extension Methods
Constructors
EnumerableTypeParserMaker()
Creates parsers for IEnumerable<T> results. The returned sequence runs the query as it is enumerated. An asynchronous query opens the reader asynchronously before returning the sequence. Use an asynchronous stream when every row must be read asynchronously.
public EnumerableTypeParserMaker()
Methods
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.
public bool TryColdStart(Type type, DbCommand cmd, ICacheGivingParser cache, bool disposeCommand, out object? result)
Parameters
typeTypecmdDbCommandThe command to run, not yet run.
cacheICacheGivingParserTurns the reader's columns into the parser for
T.disposeCommandboolWhether the command is this run's to dispose.
resultobjectThe result, when this maker took the run.
Returns
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.
public bool TryColdStart(Type type, IDbCommand cmd, ICacheGivingParser cache, bool disposeCommand, out object? result)
Parameters
typeTypecmdIDbCommandThe command to run, not yet run.
cacheICacheGivingParserTurns the reader's columns into the parser for
T.disposeCommandboolWhether the command is this run's to dispose.
resultobjectThe result, when this maker took the run.
Returns
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.
public bool TryColdStartAsync(Type type, DbCommand cmd, ICacheGivingParser cache, bool disposeCommand, CancellationToken ct, out Task<object?>? result)
Parameters
typeTypecmdDbCommandcacheICacheGivingParserdisposeCommandboolctCancellationTokenresultTask<object>
Returns
TryColdStartAsync(Type, IDbCommand, ICacheGivingParser, bool, CancellationToken, out Task<object?>?)
Attempts to produce a deferred object result for a runtime result type.
public bool TryColdStartAsync(Type type, IDbCommand cmd, ICacheGivingParser cache, bool disposeCommand, CancellationToken ct, out Task<object?>? result)
Parameters
typeTypecmdIDbCommandcacheICacheGivingParserdisposeCommandboolctCancellationTokenresultTask<object>
Returns
TryColdStartAsync<T>(DbCommand, ICacheGivingParser<T>, bool, CancellationToken, out Task<T>)
The asynchronous form of TryColdStart<T>(DbCommand, ICacheGivingParser<T>, bool, out T).
public bool TryColdStartAsync<T>(DbCommand cmd, ICacheGivingParser<T> cache, bool disposeCommand, CancellationToken ct, out Task<T> result)
Parameters
cmdDbCommandThe command to run, not yet run.
cacheICacheGivingParser<T>Turns the reader's columns into the parser for
T.disposeCommandboolWhether the command is this run's to dispose.
ctCancellationTokenThe token the caller is running under.
resultTask<T>The result, when this maker took the run.
Returns
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>)
The asynchronous form of TryColdStart<T>(DbCommand, ICacheGivingParser<T>, bool, out T).
public bool TryColdStartAsync<T>(IDbCommand cmd, ICacheGivingParser<T> cache, bool disposeCommand, CancellationToken ct, out Task<T> result)
Parameters
cmdIDbCommandThe command to run, not yet run.
cacheICacheGivingParser<T>Turns the reader's columns into the parser for
T.disposeCommandboolWhether the command is this run's to dispose.
ctCancellationTokenThe token the caller is running under.
resultTask<T>The result, when this maker took the run.
Returns
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.
public bool TryColdStart<T>(DbCommand cmd, ICacheGivingParser<T> cache, bool disposeCommand, out T result)
Parameters
cmdDbCommandThe command to run, not yet run.
cacheICacheGivingParser<T>Turns the reader's columns into the parser for
T.disposeCommandboolWhether the command is this run's to dispose.
resultTThe result, when this maker took the run.
Returns
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.
public bool TryColdStart<T>(IDbCommand cmd, ICacheGivingParser<T> cache, bool disposeCommand, out T result)
Parameters
cmdIDbCommandThe command to run, not yet run.
cacheICacheGivingParser<T>Turns the reader's columns into the parser for
T.disposeCommandboolWhether the command is this run's to dispose.
resultTThe result, when this maker took the run.
Returns
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.