Automapper many-to-many stackoverflowexception
I'm getting a stack overflow for the following mapping: Mapper.CreateMap<Parent, ParentViewModel>() .ForMember(x => x.Children, o => o.MapFrom(x => x.Children.ConvertToChildrenViewModel())); Mapper.CreateMap<Children, ChildrenViewModel>() .ForMember(x => x.Parents, o => o.MapFrom(x => x.Parents.ConvertToParentViewModel())); I understand why this is happening, clearly an infinite loop here. How am I supposed to get this to work in automapper? I need parents to know about their children and their children to know about their parents. Would I have to create another ViewModel for Children.Parents