I am getting an AutoMapper Exception when i try to Map my DomainModel to ViewModel,
Here is my Domain Model Class,
public class Source{
public string Name {get;set;}
..............
public CustomCollection EmpDetails {get;set;}
}
public class CustomCollection:CollectionBase,IEnumerable<ClassA> {
public CustomCollection{}
public int Add(ClassA classA)
{
return List.Add(classA);
}
..........
}
public class ClassA{
public string EmpNumber {get;set;}
public string EmpName {get;set;}
public string Designation {get;set;}
}
Here is my ViewModel
public class SourceDTO{
public string Name {get;set;}
public IList<EmpDTO> EmpDetails {get;set;}
}
public class EmpDTO{
public string EmpNumber {get;set;}
public string EmpName {get;set;}
public string Designation {get;set;}
}
Here is my AutoMapper Code,
AutoMapper.Mapper.CreateMap<Source, SourceDTO>()
.ForMember(x => x.EmpDetails, y => y.MapFrom(src => src.EmpDetails));
I am getting error here, It doesn't say any detail inner exceptions,
I hope someone can help us out.