Replies: 1 comment 2 replies
-
|
Support to include existing mapping configurations was recently implemented in #1833 and will be part of Mapperly 3.6.0. See also #513. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to migrate some of my projects from AutoMapper to Mapperly. I have a class structure similar to this:
I need to create two mappers: From
EnrolmenttoStudentCourseDtoand fromStudenttoStudentCourseDto. The problem is how to share the mappings of the properties ofStudentbetween these mappers?In AutoMapper, this was done using
CreateMap<Enrolment, StudentCourseDto>().IncludeMembers(e => e.Student)which would map the properties ofStudentontoStudentCourseDtobased on the existing mapping for these types.Here is what I have so far:
I thought of using
[MapNestedProperties(nameof(StudentCourseCard.Student))], but that does not take into account the mappings I created forStudent(for exampleStudentIdwon't be mapped in this example). I considered the new feature ofIncludeMappingConfiguration, but it copies the mappings verbatim (doesn't work for nested mappings which will have a different path).Is there any solution for this issue that is compatible with LINQ projections?
Beta Was this translation helpful? Give feedback.
All reactions