I used auto mapper to map some type of object to another type of object. I have to use some customer mappers to map different object models. For this task I tried to write custom mapper as below
namespace Animal.DTO.Mappers
public class CatMapper:Profile
{
public CatMapper()
{
CreateMap<WildCat,CatDto>()
.ForMember(a=>a.id,op=>op.MapFrom(x=>x.Cats.Id)
}
}
If here Cats objects from source object is list of object, this id mapper is not working. That's what I want to solve. Do you have any suggestion to find proper mapping between those to models? Following are the domain object models
public class Cat{
public int Id { get; set; }
}
public class CatDto{
public int Id { get; set; }
}
public class WildCat{
public IList<Cat> cats { get; set; }
}