c# - Autogenerate DTO elements when loading an XML for Deserialization -
suggest me proper solution autogenerating dto elements when loading proper xml deserialization.
this dto
using system; using system.collections.generic; using system.linq; using system.text; using system.xml.serialization; namespace ghelper.dto { public class elementsdto { [xmlroot("gallc")] public class farebb { [xmlelement("ip")] public string strip { get; set; } [xmlelement("port")] public int intport { get; set; } [xmlelement("type")] public int intport{ get; set; } [xmlelement("email")] public string stremail{ get; set; } } } }
here xml
<gallc> <ip>192.168.2.100</ip> <port>5051</port> <type></type> <email></email> </gallc>
the problem is: when getting lengthy xml, consume lots of time create dto it. please suggest me creating dto automatically.
given sounds you've worked out how xml schema definition (xsd) you use xsd.exe generate classes or there's even online tools it... , if want custom, t4 text templates.
Comments
Post a Comment