Automapper将对象映射到xml模板

时间:2016-03-01 14:11:03

标签: c# xml automapper

我有以下对象:

    public class Contact
{
    public string Name { get; set; }
    public string Surname { get; set; }
    public string Initials { get; set; }
    public string Street { get; set; }
    public string City { get; set; }
}

以下xml模板:

<request>
<action></action>
<service></service>
<operation></operation>
<arguments>
    <ns0:Contact xmlns:ns0="http://www.test.com/types">         
        <ns0:Name/>
        <ns0:Surname />
        <ns0:Initials />            
        <ns0:Street/>
        <ns0:City/>
    </ns0:Contact>
</arguments>
<authentication>
    <user></user>
    <password />
    <role />
    <authenticated></authenticated>
    <company />
</authentication>

如何使用Automapper将联系人映射到xml模板中的contact元素?

0 个答案:

没有答案