Table of Contents

Class TypeParser

Namespace
Rinku.Mapping
Assembly
Rinku.dll

Builds the parser that reads a result into a given T. Cached parsers decide which schemas they can accept. When none can, the makers in TypeParserMakers are tried in order and the first to claim T builds one. Add a maker to that list to register a custom result type.

public static class TypeParser
Inheritance
TypeParser
Inherited Members

Fields

TypeParserMakers

The makers tried in order to build a parser for a T, the built-in result shapes among them. Insert your own ahead of the defaults to add a shape (see the parsers guide).

public static readonly TypeParserMakerCollection TypeParserMakers

Field Value

TypeParserMakerCollection

Properties

DefaultTypeParserMaker

The fallback maker used when no registered shape maker claims a type.

public static ITypeParserMaker DefaultTypeParserMaker { get; set; }

Property Value

ITypeParserMaker

Methods

GetDefaultNullColHandler(Type)

The root nullability implied by type itself.

public static INullColHandler GetDefaultNullColHandler(Type type)

Parameters

type Type

Returns

INullColHandler

GetDefaultNullColHandler<T>()

The root nullability implied by T itself.

public static INullColHandler GetDefaultNullColHandler<T>()

Returns

INullColHandler

Type Parameters

T

GetTypeParser(Type, ColumnInfo[], INullColHandler?)

Gets the cached parser for a runtime result type and schema.

public static ITypeParser GetTypeParser(Type type, ColumnInfo[] cols, INullColHandler? nullColHandler = null)

Parameters

type Type
cols ColumnInfo[]
nullColHandler INullColHandler

Returns

ITypeParser

GetTypeParser(Type, Delegate, INullColHandler?)

Gets a parser for a runtime result type over the columns derived from schemaFactory.

public static ITypeParser GetTypeParser(Type resultType, Delegate schemaFactory, INullColHandler? nullColHandler = null)

Parameters

resultType Type
schemaFactory Delegate
nullColHandler INullColHandler

Returns

ITypeParser

GetTypeParser(Type, ConstructorInfo, INullColHandler?)

Gets a parser for a runtime result type over the columns derived from schemaConstructor.

public static ITypeParser GetTypeParser(Type resultType, ConstructorInfo schemaConstructor, INullColHandler? nullColHandler = null)

Parameters

resultType Type
schemaConstructor ConstructorInfo
nullColHandler INullColHandler

Returns

ITypeParser

GetTypeParser(Type, MemberInfo, INullColHandler?)

Gets a parser for a runtime result type over a reflected type, method, or constructor.

public static ITypeParser GetTypeParser(Type resultType, MemberInfo schemaMember, INullColHandler? nullColHandler = null)

Parameters

resultType Type
schemaMember MemberInfo
nullColHandler INullColHandler

Returns

ITypeParser

GetTypeParser(Type, MethodBase, INullColHandler?)

Gets a parser for a runtime result type over the columns derived from schemaMethod.

public static ITypeParser GetTypeParser(Type resultType, MethodBase schemaMethod, INullColHandler? nullColHandler = null)

Parameters

resultType Type
schemaMethod MethodBase
nullColHandler INullColHandler

Returns

ITypeParser

GetTypeParser(Type, Type, INullColHandler?)

Gets a parser for a runtime result type over the columns derived from schemaType.

public static ITypeParser GetTypeParser(Type resultType, Type schemaType, INullColHandler? nullColHandler = null)

Parameters

resultType Type
schemaType Type
nullColHandler INullColHandler

Returns

ITypeParser

GetTypeParser<T>(ColumnInfo[], INullColHandler?)

Gets a parser for T that accepts the supplied columns. Reuse the returned parser or a QueryCommand instead of calling this for every execution.

public static ITypeParser<T> GetTypeParser<T>(ColumnInfo[] cols, INullColHandler? nullColHandler = null)

Parameters

cols ColumnInfo[]

The columns the result carries.

nullColHandler INullColHandler

A custom root null rule. When omitted or equal to GetDefaultNullColHandler(Type), the type's own nullability applies

Returns

ITypeParser<T>

Type Parameters

T

GetTypeParser<T>(Delegate, INullColHandler?)

The parser for T over the columns derived from schemaFactory.

public static ITypeParser<T> GetTypeParser<T>(Delegate schemaFactory, INullColHandler? nullColHandler = null)

Parameters

schemaFactory Delegate
nullColHandler INullColHandler

Returns

ITypeParser<T>

Type Parameters

T

GetTypeParser<T>(ConstructorInfo, INullColHandler?)

The parser for T over the columns derived from schemaConstructor.

public static ITypeParser<T> GetTypeParser<T>(ConstructorInfo schemaConstructor, INullColHandler? nullColHandler = null)

Parameters

schemaConstructor ConstructorInfo
nullColHandler INullColHandler

Returns

ITypeParser<T>

Type Parameters

T

GetTypeParser<T>(MemberInfo, INullColHandler?)

The parser for T over a reflected type, method, or constructor.

public static ITypeParser<T> GetTypeParser<T>(MemberInfo schemaMember, INullColHandler? nullColHandler = null)

Parameters

schemaMember MemberInfo
nullColHandler INullColHandler

Returns

ITypeParser<T>

Type Parameters

T

GetTypeParser<T>(MethodBase, INullColHandler?)

The parser for T over the columns derived from schemaMethod.

public static ITypeParser<T> GetTypeParser<T>(MethodBase schemaMethod, INullColHandler? nullColHandler = null)

Parameters

schemaMethod MethodBase
nullColHandler INullColHandler

Returns

ITypeParser<T>

Type Parameters

T

GetTypeParser<T>(Type, INullColHandler?)

The parser for T over the columns derived from schemaType.

public static ITypeParser<T> GetTypeParser<T>(Type schemaType, INullColHandler? nullColHandler = null)

Parameters

schemaType Type
nullColHandler INullColHandler

Returns

ITypeParser<T>

Type Parameters

T

GetTypeParser<TSchema, T>(INullColHandler?)

The parser for T over the columns of TSchema.

public static ITypeParser<T> GetTypeParser<TSchema, T>(INullColHandler? nullColHandler = null)

Parameters

nullColHandler INullColHandler

Returns

ITypeParser<T>

Type Parameters

TSchema
T

Invalidate(Func<ITypeParser, bool>, ParserInvalidationMode)

Removes every global parser for which predicate returns true.

public static int Invalidate(Func<ITypeParser, bool> predicate, ParserInvalidationMode mode)

Parameters

predicate Func<ITypeParser, bool>

Selects the globally cached parser instances to remove.

mode ParserInvalidationMode

Controls whether caches retaining a selected parser must release it or may keep it alive.

Returns

int

The number of distinct parsers removed.

Release(ITypeParser)

Releases an owner's reference to parser and disposes it only when neither the global cache nor another subscribed cache reports that it still retains the same instance.

public static bool Release(ITypeParser parser)

Parameters

parser ITypeParser

Returns

bool

true when the parser was disposed. Otherwise false.

TryInstallDefaults(ITypeParserMaker, params ITypeParserMaker[])

Installs the initial fallback and parser makers. Call this once during startup when replacing all supplied defaults.

public static bool TryInstallDefaults(ITypeParserMaker fallback, params ITypeParserMaker[] makers)

Parameters

fallback ITypeParserMaker
makers ITypeParserMaker[]

Returns

bool

Events

ParserDisposing

Raised after a parser leaves the global cache and before it is disposed. A cache retaining the exact parser either cancels CheckUsage or releases its reference for InvalidateReferences.

public static event EventHandler<ParserDisposingEventArgs>? ParserDisposing

Event Type

EventHandler<ParserDisposingEventArgs>