Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Person
- {
- public string name;
- public List<Group> groups;
- }
- public class Group
- {
- public string name;
- public List<Person> members;
- }
- public class PersonDTO
- {
- public string name;
- public List<GroupDTO> groups;
- }
- public class GroupDTO
- {
- public string name;
- public List<PersonDTO> members;
- }
- CreateMap<Person, PersonDTO>()
- .ForMember(x => x.groups.Select(y => y.members), opt => opt.Ignore())
- .ReverseMap();
- CreateMap<Group, GroupDTO>()
- .ForMember(x => x.members.Select(y => y.groups), opt => opt.Ignore())
- .ReverseMap();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement