/// <summary> /// Initializes a new instance of the <see cref="SimpleColumnMapping{TEntity}" /> class. /// </summary> /// <param name="property">The property that the mapping is for.</param> /// <param name="columnName">Name of the column in the table.</param> /// <param name="converter">Used of the column value is not of the same type as the property.</param> public SimpleColumnMapping(Expression <Func <TEntity, object> > property, string columnName, IColumnConverter converter) { if (property == null) { throw new ArgumentNullException("property"); } if (columnName == null) { throw new ArgumentNullException("columnName"); } _columnName = columnName; _converter = converter; var member = property.GetMemberInfo(); _propertyInfo = (PropertyInfo)member.Member; }
/// <summary> /// Add a column mapping /// </summary> /// <param name="property">Property to map</param> /// <param name="columnName">Column in the table</param> /// <param name="converter">Converter (converts from the column type to the property type)</param> public void Add(Expression <Func <TEntity, object> > property, string columnName, IColumnConverter converter) { if (property == null) { throw new ArgumentNullException("property"); } if (columnName == null) { throw new ArgumentNullException("columnName"); } if (converter == null) { throw new ArgumentNullException("converter"); } var mapping = new SimpleColumnMapping <TEntity>(property, columnName, converter); _mappings.Add(mapping); }