Table of Contents

Method Create

Namespace
Open.Database.Extensions
Assembly
Open.Database.Extensions.Core.dll

Create<T>(ReadOnlySpan<KeyValuePair<string, string?>>)

Creates and validates a RowMap<T> from (property name, column name) pairs, exactly as the constructor does.

public static RowMap<T> Create<T>(ReadOnlySpan<KeyValuePair<string, string?>> mappings)

Parameters

mappings ReadOnlySpan<KeyValuePair<string, string>>

The (property name, column name) pairs; a null column means "do not map this property".

Returns

RowMap<T>

The new map.

Type Parameters

T

The model type whose properties are mapped.

Remarks

This is what a collection expression of pairs calls; an empty one maps by name.

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>).