自动映射器DynamicMap丢失 [英] Automapper DynamicMap missing
问题描述
I was reading in a previous question on "How to use AutoMapper to map a DataRow to an object in a WCF service?" and I thought 'Great! That's what I'm looking for on mapping a table from MySQL!', yet after I got the Nuget package and tried to use that line of code like this:
List<Customer> c = AutoMapper.Mapper.DynamicMap<IDataReader, List<Customer>>(dt.CreateDataReader());
我遇到了这个例外:
地图"不包含动态地图"的定义
'Mapper' does not contain a definition for 'DynamicMap'
在网上检查了一下之后,我发现它已经被取出了.那么如何从MySQL数据库表创建一个列表?
After checking around on the 'net about it, I found out it's been taken out. So then how does one create a List from MySQL DB Table?
推荐答案
自3.1.1版本以来,AutoMapper进行了许多更改.
The AutoMapper has many changes since the 3.1.1 version.
下面从DynamicMap
方法更改为Map
方法的更改应该起作用.
The below change from DynamicMap
method to Map
method should work.
List<Customer> c = AutoMapper.Mapper.Map<IDataReader, List<Customer>>(dt.CreateDataReader());
这篇关于自动映射器DynamicMap丢失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!