下面的代码有什么区别;
List<Ogrenci> ogrenci = AutoMapper.Mapper.DynamicMap<IDataReader, List<Ogrenci>>((dt.CreateDataReader()));
var ogr = AutoMapper.Mapper.Map<IDataReader, IList<Ogrenci>>(dt.CreateDataReader());
当我尝试使用下面的代码时;
AutoMapper.Mapper.CreateMap<IDataReader, Ogrenci>().ForMember(dest => dest.Numarasi, opt => opt.MapFrom(src => Convert.ToInt32(src["Numara"])))
.ForMember(dest => dest.Adi, opt => opt.MapFrom(src => Convert.ToString(src["Ad"])))
.ForMember(dest => dest.Soyadi, opt => opt.MapFrom(src => Convert.ToString(src["Soyad"])));
List<Ogrenci> ogrenci = AutoMapper.Mapper.DynamicMap<IDataReader, List<Ogrenci>>((dt.CreateDataReader()));
var ogr = AutoMapper.Mapper.Map<IDataReader, IList<Ogrenci>>(dt.CreateDataReader());
我不能使用下面的代码;
List<Ogrenci> ogrenci = AutoMapper.Mapper.DynamicMap<IDataReader, List<Ogrenci>>((dt.CreateDataReader()));
但我可以使用下面的代码;
var ogr = AutoMapper.Mapper.Map<IDataReader, IList<Ogrenci>>(dt.CreateDataReader());
你有什么建议?
谢谢你。