Constructor RowMap
- Namespace
- Open.Database.Extensions
- Assembly
- Open.Database.Extensions.Core.dll
RowMap(KeyValuePair<string, string?>)
Initializes a new instance of the RowMap<T> class from one (property name, column name) pair.
public RowMap(KeyValuePair<string, string?> mapping)
Parameters
mappingKeyValuePair<string, string>The (property name, column name) pair; a null column means "do not map this property".
Remarks
Declare the map once: a map built in a call is rebuilt, and its row reader compiled, on every call.
Exceptions
- ArgumentException
A pair is invalid: an unknown or unsettable property or constructor parameter, a member named twice, an empty column name, a null column for a required property, or two members reading one column (see RowMap<T>).
- InvalidOperationException
The model type cannot be mapped (see RowMap<T>).
RowMap(params ReadOnlySpan<KeyValuePair<string, string?>>)
Initializes a new instance of the RowMap<T> class from (property name, column name) pairs.
public RowMap(params ReadOnlySpan<KeyValuePair<string, string?>> mappings)
Parameters
mappingsReadOnlySpan<KeyValuePair<string, string>>The (property name, column name) pairs; a null column means "do not map this property".
Remarks
Declare the map once: a map built in a call is rebuilt, and its row reader compiled, on every call.
Exceptions
- ArgumentException
A pair is invalid: an unknown or unsettable property or constructor parameter, a member named twice, an empty column name, a null column for a required property, or two members reading one column (see RowMap<T>).
- InvalidOperationException
The model type cannot be mapped (see RowMap<T>).
RowMap(ImmutableArray<KeyValuePair<string, string?>>)
Initializes a new instance of the RowMap<T> class from (property name, column name) pairs held in an ImmutableArray<T>.
public RowMap(ImmutableArray<KeyValuePair<string, string?>> mappings)
Parameters
mappingsImmutableArray<KeyValuePair<string, string>>The (property name, column name) pairs; a null column means "do not map this property".
Remarks
A default array is no mappings.
Declare the map once: a map built in a call is rebuilt, and its row reader compiled, on every call.
Exceptions
- ArgumentException
A pair is invalid: an unknown or unsettable property or constructor parameter, a member named twice, an empty column name, a null column for a required property, or two members reading one column (see RowMap<T>).
- InvalidOperationException
The model type cannot be mapped (see RowMap<T>).
RowMap(IEnumerable<KeyValuePair<string, string?>>?)
Initializes a new instance of the RowMap<T> class from (property name, column name) pairs.
public RowMap(IEnumerable<KeyValuePair<string, string?>>? mappings)
Parameters
mappingsIEnumerable<KeyValuePair<string, string>>The (property name, column name) pairs, or null for none; a null column means "do not map this property".
Remarks
Declare the map once: a map built in a call is rebuilt, and its row reader compiled, on every call.
Exceptions
- ArgumentException
A pair is invalid: an unknown or unsettable property or constructor parameter, a member named twice, an empty column name, a null column for a required property, or two members reading one column (see RowMap<T>).
- InvalidOperationException
The model type cannot be mapped (see RowMap<T>).
- ArgumentException
mappingsis a factory map, which cannot be rebuilt from its pairs: its function is not among them. Use the map itself.