1

I am using latest version of AutoMapper in my application. I want to convert DataTable object to List type, I am using following code Where reader is of type DataTable

Mapper.CreateMap<IDataReader, List<AutoShiftReportConfigDto>>();
var response = Mapper.Map<IDataReader, List<AutoShiftReportConfigDto>>(reader.CreateDataReader());

But it returns always 0 Counts, My DataTable column name are also same as AutoShiftReportConfigDto's property type and name

Paresh Makwana
  • 189
  • 2
  • 14
  • Looks like this might be a bug in Automapper (https://github.com/AutoMapper/AutoMapper/issues/835). Although the github issue states it will be fixed in 4.1, I just put together a quick sample using 4.1 and the mapping returned no rows. – PatrickSteele Oct 23 '15 at 12:08

1 Answers1

3

AutoMapper's handling of IDataReader has been pulled out of core as of version 4. It will eventually land in Automapper.Data. If you need this to work, stick with version 3.x.

Source

Josh
  • 4,009
  • 2
  • 31
  • 46