-
Notifications
You must be signed in to change notification settings - Fork 0
Home
RowDelimiter(string rowDelimiter) - Allows you to change the row delimiter. The default is "\n"
HeaderDelimiter(string headerDelimiter) - Allows you to change the header delimiter. The default is to copy the column delimeter.
ColumnDelimiter(string columnDelimiter) - Allows you to change the column delimiter. The default is ",".
ColumnTrimChars(char[] trimChars) - Allows you to specify which characters are trimmed when columns are read. Defaults to ' ', '\r', '\t'.
DefaultParseFailureBehavior(ParseFailureDefault columnParseFailureDefault) - Allows you to choose the behavior when if a parsing failure occurs.
AllowTooFewColumns() - Allows for a row/rows with less columns than expected, based on the mapping. By default if a row with too few columns is encountered an exception will be thrown.
StringDelimiter(char stringDelimiter = '"', char stringDelimiterEscape = '\\') - Allows you to specify the string delimiter and string delimiter escape characters.
StringTrimOptions(bool trimStringDelimiter = true, StringTrim stringOptions = StringTrim.TrimUntilStringDelimiter) - Allows you to choose how/if a string is trimmed.
By default, much like entity framework, the source generator will choose the best constructor to use for creating objects. In order for a constructor to be considered for the best constructor, all of it's arguments must match property names (ignoring case). The best constructor is the constructor that has the most property name/argument matches.
ChooseEmptyConstructor()
ChooseConstructor<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15, P16>()
The above two methods allow you to override the best constructor default and let you choose the constructor based on argument types. Additionally, again, just like entity framework, you can create objects and use constructors that you normally couldn't (private, internal, etc.) as well as set properties you normally couldn't.
AutoMapByIndex() - Will map the columns found in the CSV file, in the same order as the class you are mapping to. NOTE: is you are using partial classes, or inheritence, this may not work correctly.
AutoMapByName(StringComparison nameMappingStringComparision = StringComparison.Ordinal, char[] headerTrimChars = null, char[] headerRemoveChars = null) - Will map columns found in the CSV file by name.
nameMappingStringComparision - Allows you to compare by ignoring case, etc.
headerTrimChars - What characters to trim from header names. If left null, it will copy the column trim characters.
headerRemoveChars - What characters to remove from any position in the header names. EX. If set to { ' ' } "First Name" becomes "FirstName"
MapToColumns()