Table of Contents

Class CachedTypeParser

Namespace
Rinku
Assembly
Rinku.dll

Holds one result schema and caches a parser for every result type requested over it. A parameterless instance learns the schema from its first query. The instance can be shared across threads.

public sealed class CachedTypeParser : IDisposable
Inheritance
CachedTypeParser
Implements
Inherited Members
Extension Methods

Constructors

CachedTypeParser()

Creates a cache that learns its result columns from the first query.

public CachedTypeParser()

CachedTypeParser(ColumnInfo[])

Creates a cache for the supplied result columns.

public CachedTypeParser(ColumnInfo[] schema)

Parameters

schema ColumnInfo[]

CachedTypeParser(Delegate)

Creates a cache for columns derived from a delegate's parameters.

public CachedTypeParser(Delegate schemaFactory)

Parameters

schemaFactory Delegate

CachedTypeParser(ConstructorInfo)

Creates a cache for columns derived from a constructor's parameters.

public CachedTypeParser(ConstructorInfo schemaConstructor)

Parameters

schemaConstructor ConstructorInfo

CachedTypeParser(MethodBase)

Creates a cache for columns derived from a method's parameters.

public CachedTypeParser(MethodBase schemaMethod)

Parameters

schemaMethod MethodBase

CachedTypeParser(Type)

Creates a cache for columns derived from schemaType.

public CachedTypeParser(Type schemaType)

Parameters

schemaType Type

Properties

HasSchema

Whether this instance already knows its fixed result columns.

public bool HasSchema { get; }

Property Value

bool

Schema

The fixed columns every parser from this cache accepts.

public ColumnInfo[] Schema { get; }

Property Value

ColumnInfo[]

Exceptions

InvalidOperationException

The parameterless instance has not run a query yet.

Methods

Dispose()

Releases every parser held by this instance and stops it from receiving invalidation notices.

public void Dispose()

From<TSchema>()

Creates a cache for the columns derived from TSchema.

public static CachedTypeParser From<TSchema>()

Returns

CachedTypeParser

Type Parameters

TSchema

Get(Type, INullColHandler?)

Gets the parser for a runtime result type over this cache's fixed schema.

public ITypeParser Get(Type type, INullColHandler? nullColHandler = null)

Parameters

type Type
nullColHandler INullColHandler

Returns

ITypeParser

Get<T>(INullColHandler?)

Gets the parser for T over this cache's fixed schema.

public ITypeParser<T> Get<T>(INullColHandler? nullColHandler = null)

Parameters

nullColHandler INullColHandler

Returns

ITypeParser<T>

Type Parameters

T

Invalidate()

Forgets every parser held by this cache.

public int Invalidate()

Returns

int

The number of distinct parsers removed.

Invalidate<T>(INullColHandler?)

Forgets the parser for T held by this cache.

public bool Invalidate<T>(INullColHandler? nullColHandler = null)

Parameters

nullColHandler INullColHandler

Returns

bool

true when a parser was removed.

Type Parameters

T

Query(Type, DbCommand, bool)

Queries cmd while mapping the result to a runtime type.

public object? Query(Type type, DbCommand cmd, bool disposeCommand = false)

Parameters

type Type
cmd DbCommand
disposeCommand bool

Returns

object

Query(Type, IDbCommand, bool)

Queries cmd while mapping the result to a runtime type.

public object? Query(Type type, IDbCommand cmd, bool disposeCommand = false)

Parameters

type Type
cmd IDbCommand
disposeCommand bool

Returns

object

QueryAsync(Type, DbCommand, bool, CancellationToken)

Asynchronously queries cmd while mapping the result to a runtime type.

public Task<object?> QueryAsync(Type type, DbCommand cmd, bool disposeCommand = false, CancellationToken ct = default)

Parameters

type Type
cmd DbCommand
disposeCommand bool
ct CancellationToken

Returns

Task<object>

QueryAsync(Type, IDbCommand, bool, CancellationToken)

Asynchronously queries cmd while mapping the result to a runtime type.

public Task<object?> QueryAsync(Type type, IDbCommand cmd, bool disposeCommand = false, CancellationToken ct = default)

Parameters

type Type
cmd IDbCommand
disposeCommand bool
ct CancellationToken

Returns

Task<object>

QueryAsync<T>(DbCommand, ICache, bool, CancellationToken)

Asynchronously queries cmd while updating cache.

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

Parameters

cmd DbCommand
cache ICache
disposeCommand bool
ct CancellationToken

Returns

Task<T>

Type Parameters

T

QueryAsync<T>(DbCommand, bool, CancellationToken)

Asynchronously queries cmd as T and learns the fixed schema when needed.

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

Parameters

cmd DbCommand
disposeCommand bool
ct CancellationToken

Returns

Task<T>

Type Parameters

T

QueryAsync<T>(IDbCommand, ICache, bool, CancellationToken)

Asynchronously queries cmd while updating cache.

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

Parameters

cmd IDbCommand
cache ICache
disposeCommand bool
ct CancellationToken

Returns

Task<T>

Type Parameters

T

QueryAsync<T>(IDbCommand, bool, CancellationToken)

Asynchronously queries cmd as T and learns the fixed schema when needed.

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

Parameters

cmd IDbCommand
disposeCommand bool
ct CancellationToken

Returns

Task<T>

Type Parameters

T

Query<T>(DbCommand, ICache, bool)

Queries cmd while updating cache.

public T Query<T>(DbCommand cmd, ICache cache, bool disposeCommand = false)

Parameters

cmd DbCommand
cache ICache
disposeCommand bool

Returns

T

Type Parameters

T

Query<T>(DbCommand, bool)

Queries cmd as T and learns the fixed schema when needed.

public T Query<T>(DbCommand cmd, bool disposeCommand = false)

Parameters

cmd DbCommand
disposeCommand bool

Returns

T

Type Parameters

T

Query<T>(IDbCommand, ICache, bool)

Queries cmd while updating cache.

public T Query<T>(IDbCommand cmd, ICache cache, bool disposeCommand = false)

Parameters

cmd IDbCommand
cache ICache
disposeCommand bool

Returns

T

Type Parameters

T

Query<T>(IDbCommand, bool)

Queries cmd as T and learns the fixed schema when needed.

public T Query<T>(IDbCommand cmd, bool disposeCommand = false)

Parameters

cmd IDbCommand
disposeCommand bool

Returns

T

Type Parameters

T

StreamQueryAsync<T>(DbCommand, bool, CancellationToken)

Streams rows from cmd as T over this cache's fixed schema.

public IAsyncEnumerable<T> StreamQueryAsync<T>(DbCommand cmd, bool disposeCommand = false, CancellationToken ct = default)

Parameters

cmd DbCommand
disposeCommand bool
ct CancellationToken

Returns

IAsyncEnumerable<T>

Type Parameters

T