1

I have an xml generated from a wsdl which is deeply nested with and contain a lot of field. The structure of the xml is in the form

<types:Top>
  <types:Landlords>
   <types:County>
     <types:State>
        <types:Locality>
           <types:FirstName>Hackaton</types:FirstName>
           <types:FirstName>Manker</types:FirstName>
        </types:Locality>
          <types:Locality>
           <types:LastName>Hackaton</types:LastName>
        </types:Locality>
     <types:State/>
  </types:County>
 </types:Landords>
<types:Top>

I have generated by class from the wsdl and but mapping this field by hand is really error prone and I am not sure if it is even the best way to go. Please is this possible to do with automapper.

Mapper.Map<Domain , Landords>();
Mapper.Map<Domain, County>(); 
Mapper.Map<Domain, State>() ; 
Mapper.Map<Domain, Locality>().ForMember(s=>s.FirstName , m=>m.mapFrom(e=>e.FirstName));

I have tried the above in automapper with no luck of mapping. Any idea of how to map this kind of object such that it is maintainable for over 600 fields On the side note my Domain is really flat.

damola
  • 282
  • 5
  • 18

0 Answers0