-
Notifications
You must be signed in to change notification settings - Fork 3.7k
feat: Add Volo.Abp.Mapperly module
#23277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
every mapper class we need write: Is there a way to automate these template codes? |
I didn't find it. |
|
Suggestion: Rename |
|
Reverse is from AutoMapper, and it's just for easier understanding. |
|
Can the generated class have access to the IServiceProvider from the base class? Some custom mappers can required the injection of services. |
No problem, you can see this mapper class: https://github.com/abpframework/abp/blob/9e0d0413d0cf6c23d7fb4db17a9e8183bcb88d35/framework/test/Volo.Abp.Mapperly.Tests/Volo/Abp/Mapperly/AbpMapperly_Dependency_Injection_Tests.cs |
|
Renaming Actually even |
Changed. |
Description
Resolves #23243
We need to create a mapper that inherits from
MapperBase<TSource, TDestination>for each DTO class, and then you can use various features of Mapperly in this mapper class. You can also override theBeforeMapandAfterMapmethods to perform some actions.The
MyClassMapperwill be added to the DI system. You can also inject services in this mapper class.Mapperly will generate the implementation
Mapmethods code during the build process.If you want the mapper to support reverse mapping, you can use
TwoWayMapperBaseas the base class.