0
我的例子:Automapper失敗用於與其中的物品使用ConvertUsing <集合對象>()
class BoxVM {
int BoxId {get;set;}
List<ItemVM> Items {get;set;}
}
class Box {
int BoxId {get;set;}
List<Item> Items {get;set;}
}
隨着映射配置:
CreateMap<BoxVM, Box>();
CreateMap<ItemVM, Item>().ConvertUsing<ItemTypeConverter>();
當轉換BoxVM
將Items
,所述ItemTypeConverter
不被調用。在Box
中留下一個空的Items
集合。
BoxId映射正確。
我錯過了一個步驟嗎?
原因是屬性名稱中的拼寫錯誤! – PenFold