Table of Contents

Interface ITypeConverter

Namespace
Rinku.Mapping
Assembly
Rinku.dll

Converts a column's value from the type the reader gives to the type a member wants, a cast, a parse, a constructor, an implicit operator. This is how a mapping bridges the gap when the two types differ.

public interface ITypeConverter
Extension Methods

Fields

FormatProvider

The culture to use for the parsing

public static IFormatProvider FormatProvider

Field Value

IFormatProvider

Properties

OutputType

The type produced by the conversion.

Type OutputType { get; }

Property Value

Type

Methods

EmitConversion(Generator, Type)

Converts the current value to OutputType.

void EmitConversion(Generator generator, Type sourceType)

Parameters

generator Generator
sourceType Type

TryGetConverter(Type, Type, out ITypeConverter)

Finds a way to convert from sourceType to outputType, trying assignment, primitive casts, string parsing, a matching constructor, and implicit or explicit operators in turn. Returns false when no path exists.

public static bool TryGetConverter(Type sourceType, Type outputType, out ITypeConverter converter)

Parameters

sourceType Type
outputType Type
converter ITypeConverter

Returns

bool

TryGetExactConverter(Type, Type, out ITypeConverter)

Finds an identity converter only when the source and target types are exactly equal. Nullable targets compare their underlying type because the reader column carries nullability separately.

public static bool TryGetExactConverter(Type sourceType, Type outputType, out ITypeConverter converter)

Parameters

sourceType Type
outputType Type
converter ITypeConverter

Returns

bool