/// <summary> /// If a column name in your model does not match the designated column name in the actual SQL table, /// you can add a custom column mapping. /// </summary> /// <returns></returns> public DataTableAllColumnSelect <T> CustomColumnMapping(Expression <Func <T, object> > source, string destination) { var propertyName = BulkOperationsHelper.GetPropertyName(source); CustomColumnMappings.Add(propertyName, destination); return(this); }
/// <summary> /// Add each column that you want to include in the query. Only include the columns that are relevant to the /// procedure for best performance. /// </summary> /// <param name="columnName">Column name as represented in database</param> /// <param name="destination">The actual name of column as represented in SQL table. By default SqlBulkTools will attempt to match the model property names to SQL column names (case insensitive). /// If any of your model property names do not match /// the SQL table column(s) as defined in given table, then use this overload to set up a custom mapping. </param> /// <returns></returns> public BulkAddColumn <T> AddColumn(Expression <Func <T, object> > columnName, string destination) { if (destination == null) { throw new ArgumentNullException(nameof(destination)); } var propertyName = BulkOperationsHelper.GetPropertyName(columnName); _columns.Add(propertyName); CustomColumnMappings.Add(propertyName, destination); return(this); }