Как вы сопоставляете свойство, которое уже сопоставлено с исходным объектом? Я не хочу использовать наследование
public class ParentMappingProfile: Profile{
public ParentMappingProfile(){
CreateMap<App.Context.Person,Parent>()
/*this line works*/
.ForMember(dest=>dest.Children,
opt=>opt.MapFrom(src=>src.IdInversedNavigation))
/*this does not work, person remains null*/
.ForMember(dest=>dest.Person, opt=>opt.MapFrom(src=>src));
}
}
вот другие классы
public class PersonBase{
public int id{get;set;}
public string Name{get;set;}
}
public class PersonMappingProfile: Profile{
public PersonMappingProfile(){
CreateMap<App.Context.Person,PersonBase>()
ForMember(...);
}
}
public class Parent{
public PersonBase Person{get;set;};
public IEnumerable<PersonBase> Children{get;set;};
}