Class ReusingBaseTypeParserMaker
A base class for a result type that wraps one element type.
Derive from this class for wrappers such as Result<T>.
Implement ITypeParserMaker directly for other result types.
public class ReusingBaseTypeParserMaker : ITypeParserMaker
- Inheritance
-
ReusingBaseTypeParserMaker
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
ReusingBaseTypeParserMaker(Type[], GetParserType, GetParserType?, Func<Type, Type>?)
A base class for a result type that wraps one element type.
Derive from this class for wrappers such as Result<T>.
Implement ITypeParserMaker directly for other result types.
public ReusingBaseTypeParserMaker(Type[] acceptedGenericDefinitions, GetParserType GetParserType, GetParserType? GetParserTypeWhenSimple = null, Func<Type, Type>? GetElementType = null)
Parameters
acceptedGenericDefinitionsType[]GetParserTypeGetParserTypeGetParserTypeWhenSimpleGetParserTypeGetElementTypeFunc<Type, Type>
Methods
CanHandle<T>()
Whether this maker claims T.
public bool CanHandle<T>()
Returns
Type Parameters
T
DeclaredElementNullability(Type)
The element nullability a wrapper definition declares on its value parameter, resolved by GetDeclaredNullColHandler(Type, string?, object[], object?) (e.g. the MaybeNullAttribute on OptionalNullable<T>). null when nothing is declared, the element's own type decides.
public static INullColHandler? DeclaredElementNullability(Type definition)
Parameters
definitionType
Returns
TryMakeParser<T>(INullColHandler, ColumnInfo[], out ITypeParser<T>)
Builds the parser for T over the given columns, or returns false
to decline.
public bool TryMakeParser<T>(INullColHandler nullColHandler, ColumnInfo[] cols, out ITypeParser<T> parser)
Parameters
nullColHandlerINullColHandlercolsColumnInfo[]parserITypeParser<T>
Returns
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.