AutoMapper for NpgsqlDataReader to POCO class

37 views
Skip to first unread message

nivrutt...@gmail.com

unread,
Aug 13, 2020, 1:49:47 PM8/13/20
to AutoMapper-users
Hi 

I am trying the below code. I had used the Automapper.Data. But no luck

var mapper = new MapperConfiguration(cfg =>
            {
                cfg.AddDataReaderMapping();
                cfg.SourceMemberNamingConvention = new LowerUnderscoreNamingConvention();
                cfg.DestinationMemberNamingConvention = new PascalCaseNamingConvention();
                cfg.CreateMap<IDataReader, MyDTO>();
            }).CreateMapper();

List<MyDTO> lstdto = (List<MyDTO>)mapper.Map<IDataReader, IEnumerable<MyDTO>>(dbDataReader);

this code is not working. Do i need to add mapping while calling cfg.CreateMap???

Thanks
Nivrutti

nivrutt...@gmail.com

unread,
Aug 13, 2020, 1:50:25 PM8/13/20
to AutoMapper-users
I am using .NET Core 3.1
Reply all
Reply to author
Forward
0 new messages