Method Map
Map<TProperty>(Expression<Func<TObject, TProperty>>, string, EntityMappingSource, Func<object, TProperty>, bool)
Defines a mapping from a field in the record to a property on the object.
IMappingBuilder<TObject> Map<TProperty>(Expression<Func<TObject, TProperty>> destination, string path, EntityMappingSource entityMappingSource = EntityMappingSource.Property, Func<object, TProperty> converter = null, bool optional = false)
Parameters
destination
Expression<Func<TObject, TProperty>>The property to map to.
path
stringThe key of the field in the record.
entityMappingSource
EntityMappingSourceA value indicating the type of value to be mapped from the specified field.
converter
Func<object, TProperty>An optional converter function to convert the value from the field value to the type of the property.
optional
boolA value indicating whether the mapping is optional. If true, the mapping will not throw an exception if the field is not present in the record.
Returns
- IMappingBuilder<TObject>
This instance for method chaining.
Type Parameters
TProperty
The type of the property being mapped. This type will be inferred from the
destination
parameter.
Map<TProperty>(Expression<Func<TObject, TProperty>>, Func<IRecord, object>)
Defines a mapping directly from the record to a property on the object.
IMappingBuilder<TObject> Map<TProperty>(Expression<Func<TObject, TProperty>> destination, Func<IRecord, object> valueGetter)
Parameters
destination
Expression<Func<TObject, TProperty>>The property to map to.
valueGetter
Func<IRecord, object>A function that accepts an IRecord and returns the value to be stored in the property.
Returns
- IMappingBuilder<TObject>
This instance for method chaining.
Type Parameters
TProperty
The type of the property being mapped. This type will be inferred from the
destination
parameter.