source/Nevermore/Mapping/DocumentMap.cs
/// <summary>
/// Defines a column. The column name will be the name of the property.
/// </summary>
/// <param name="columnName">The name of the column that the property will be stored in.</param>
/// <param name="getter">An expression that accesses the property. E.g., <code>c => c.FirstName</code></param>
/// <param name="setter">A func called when reading data from the database and setting it on the object.</param>
/// <typeparam name="TProperty">The property type of the column.</typeparam>
/// <returns>A builder to further configure the column mapping.</returns>
Defines a column. The column name will be the name of the property.
Defines a column . The column name will be the name of the property .
protected IColumnMappingBuilder Column<TProperty>(string columnName, Expression<Func<TDocument, TProperty>> getter, Action<TDocument, TProperty> setter)
        {
            var property = GetPropertyInfo(getter ?? throw new ArgumentNullException(nameof(getter)));
            if (property != null && setter == null)
            {
                return Column(columnName ?? property.Name, typeof(TProperty), new PropertyHandler(property), property);
            }
            return Column(columnName ?? throw new ArgumentNullException(nameof(columnName)), typeof(TProperty), new DelegatePropertyHandler<TDocument, TProperty>(getter.Compile(), setter), property);
        }
protected IColumnMappingBuilder Column < TProperty > ( string columnName , Expression < Func < TDocument , TProperty > > getter , Action < TDocument , TProperty > setter ) { var property = GetPropertyInfo ( getter ?? throw new ArgumentNullException ( nameof ( getter ) ) ) ; if ( property != null && setter == null ) { return Column ( columnName ?? property . Name , typeof ( TProperty ) , new PropertyHandler ( property ) , property ) ; } return Column ( columnName ?? throw new ArgumentNullException ( nameof ( columnName ) ) , typeof ( TProperty ) , new DelegatePropertyHandler < TDocument , TProperty > ( getter . Compile ( ) , setter ) , property ) ; }
Defines a column.
Defines a column .
A builder to further configure the column mapping.
A builder to further configure the column mapping .
columnName
string
The name of the column that the property will be stored in.
The name of the column that the property will be stored in .
getter
Expression<Func<TDocument, TProperty>>
An expression that accesses the property. E.g., c => c.FirstName
An expression that accesses the property . E . g . c = > c . FirstName
setter
Action<TDocument, TProperty>
A func called when reading data from the database and setting it on the object.
A func called when reading data from the database and setting it on the object .
typeparam
The property type of the column.
The property type of the column .