IEnumerable and nested collections
I have a nested structure that follows this XML, with entities corresponding to the outer, middle & inner objects.
<MyXml>
<OuterObject>
<OuterObjectID>123</OuterObjectID>
<OuterObjectName>Out1</OuterObjectName>
<MiddleObjectList>
<MiddleObject>
<MiddleObjectID>456</MiddleObjectID>
<MiddleObjectName>Middle1</MiddleObjectName>
<KeyRelatedToChildInnerObjects>InnerObjKey1</KeyRelatedToChildInnerObjects>
<InnerObjectList>
<InnerObject>
<InnerObjectID>789</InnerObjectID>
<InnerObjectName>Need_to_map_based_in_InnerObjKey1</InnerObjectName>
</InnerObject>
<InnerObject>
<InnerObjectID>654</InnerObjectID>
<InnerObjectName>This_too_InnerObjects_are_from_different_entity</InnerObjectName>
</InnerObject>
</InnerObjectList>
</MiddleObject>
</MiddleObjectList>
</OuterObject>
<OuterObject>
...
</OuterObject>
</MyXml>
I'm trying to set the values of and populate the InnerObject collection using AutoMapper. These will come from a different entity/table, and will be related by the key stated in it's parent MiddleObject. I have entities/DTOs that correspond to OuterObject and MiddleObject but am having trouble getting the InnerObject mapped. Thanks for any help.
链接地址: http://www.djcxy.com/p/37430.html上一篇: Automapper EF6动态代理
下一篇: IEnumerable和嵌套集合