c# - using AutoMapper for map XML to Object with List Property -


i know basics of right way map xml type objects received xml service different! xml this:

<group>     <title>friends</title>     <member>         <name>omid</name>     </member>     <member>         <name>kourosh</name>     </member> <group> 

and object is:

public class group {     public string title { get; set; };     public icollection<member> members { get; set; }; } 

so when try map xelement (from xml) group members don't map :( whats best way? changing xml? using specific config automapper? , how? thanks

i read this useful article , change _mapitems solve problem:

private static func<xelement, string, list<xelement>> _mapitems =     (src, elementname) =>     src.elements(elementname).tolist(); 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -