Reputation: 413
In the source CSV the time but not the date is provided in a field. Is there a way to pass the datetime value to the map class so then we could just combine both using the ConvertUsing?
PseudoCode:
csv.Configuration.RegisterClassMap<RhodesMoClassMap>("DateTime");
public MoClassMap(DateTime date)
{
Map(m => m.TimeLastTick).ConvertUsing(row =>
{
var timePart = row.GetField("Time last tick");
var combined = date + timePart;
return combinedDateTime;
});
}
I have seen some questions about this but no examples and the last thread seemed to melt away a few years ago.
Upvotes: 2
Views: 1064
Reputation: 9074
csv.Configuration.RegisterClassMap(new RhodesMoClassMap(date));
Upvotes: 5