D E
D E

Reputation: 23

Type does not have a default constructor automapper

I have a problem:

public class TDocumentation
{
   public XmlElement Summary { get; set; }

   public XmlElement LongDescription { get; set; }

   public XmlAttribute[] AnyAttr { get; set; }
}

...and:

public class ProxieTDocumentation
{
    public XmlElement Summary { get; set; }

    ......
}


Mapper.CreateMap<Proxies.TDocumentation, TDocumentation>()

...throws:

----> System.ArgumentException : Type "System.Xml.XmlElement" does not have a default constructor automapper

How I can make a mapping on another?

Upvotes: 0

Views: 2165

Answers (1)

D E
D E

Reputation: 23

I resolve thie promleb:

Mapper.CreateMap<XmlElement, XmlElement>().ConvertUsing(item => item != null ? item.Clone() as XmlElement : null);

Upvotes: 1

Related Questions