Automapper -cannot resolve the Generic List
- by chugh97
Mapper.CreateMap<BusinessObject, Proxy.DataContacts.DCObject>()
.ForMember(x => x.ExtensionData, y => y.Ignore())
.ForMember(z => z.ValidPlaces, a=> a.ResolveUsing(typeof(ValidPlaces)));
Mapper.AssertConfigurationIsValid();
public class BusinessObject
{
public Enum1 Enum1 { get; set; }
public List<ValidPlaces> ValidPlaces{ get; set; }
}
public class ValidPlaces
{
public int No { get; set; }
public string Name { get; set; }
}
public class DCObject
{
[DataMember]
public Enum1 Enum1 { get; set; }
[DataMember]
public List<ValidPlaces> ValidPlaces{ get; set; }
}
Mapper.CreateMap works find when Mapper.AssertConfigurationIsValid(); is called but
when I actually call into the service the Automapper throws and excetion saying ValidPlaces could not be mapped.Works fine if I put Ignore() but ideally want that passed.Any AutoMapper experts out there pls help.