Is your feature request related to a problem? Please describe.
Entities in e.g. EF Core often have a non-nullable ID. I'd like to be able to import data for them from a CSV file where the ID will sometimes be specified and sometimes not.
It would make sense to be able to omit the ID from the CSV in the case we aren't specifying it - so effectively it would be treated as 0.
Describe the solution you'd like
We are already able to configure values that are interpreted as true/false boolean values, e.g. csv.Context.TypeConverterOptionsCache.GetOptions<bool>().BooleanTrueValues.AddRange(new[] { "Y", "Yes" });
It seems like more generally there could be a way to map equivalent values - that's effectively what the above is doing: "Y" and "Yes" map to (bool) true. I'd like to also specify that "" or null map to (int) 0.
Describe alternatives you've considered
Could add a separate class just for use with CSVHelper and make the property nullable.
Is your feature request related to a problem? Please describe. Entities in e.g. EF Core often have a non-nullable ID. I'd like to be able to import data for them from a CSV file where the ID will sometimes be specified and sometimes not.
It would make sense to be able to omit the ID from the CSV in the case we aren't specifying it - so effectively it would be treated as 0.
Describe the solution you'd like We are already able to configure values that are interpreted as true/false boolean values, e.g.
csv.Context.TypeConverterOptionsCache.GetOptions<bool>().BooleanTrueValues.AddRange(new[] { "Y", "Yes" });
It seems like more generally there could be a way to map equivalent values - that's effectively what the above is doing: "Y" and "Yes" map to (bool) true. I'd like to also specify that "" or null map to (int) 0.
Describe alternatives you've considered Could add a separate class just for use with CSVHelper and make the property nullable.