diff --git a/docs/en/framework/fundamentals/object-extensions.md b/docs/en/framework/fundamentals/object-extensions.md index 2e01b3b1e3..87ece27f75 100644 --- a/docs/en/framework/fundamentals/object-extensions.md +++ b/docs/en/framework/fundamentals/object-extensions.md @@ -398,7 +398,7 @@ It has the same parameters with the `MapExtraPropertiesTo` method. If you're using the [Mapperly](https://github.com/riok/mapperly) library, the ABP also provides an extension method to utilize the `MapExtraPropertiesTo` method defined above. -You can use the `MapExtraProperties` attribute to Mapperly class. +You can use the `MapExtraProperties` attribute to Mapperly class: ````csharp [Mapper] diff --git a/docs/en/framework/infrastructure/object-to-object-mapping.md b/docs/en/framework/infrastructure/object-to-object-mapping.md index 52da7a258a..5a9ea5f82a 100644 --- a/docs/en/framework/infrastructure/object-to-object-mapping.md +++ b/docs/en/framework/infrastructure/object-to-object-mapping.md @@ -225,7 +225,7 @@ Once you define mappings class as below, you can use the `IObjectMapper` interfa ### Define Mapping Classes -You can define a mapper class by using the `Mapper` attribute. The class and methods must be `partial` to allow the Mapperly to generate the implementation during the build process. +You can define a mapper class by using the `Mapper` attribute. The class and methods must be `partial` to allow the Mapperly to generate the implementation during the build process: ````csharp [Mapper] @@ -236,7 +236,7 @@ public partial class UserToUserDtoMapper : MapperBase } ```` -If you also want to map `UserDto` to `User`, you can inherit from the `TwoWayMapperBase` class. +If you also want to map `UserDto` to `User`, you can inherit from the `TwoWayMapperBase` class: ````csharp [Mapper] @@ -252,7 +252,7 @@ public partial class UserToUserDtoMapper : TwoWayMapperBase ### Before and After Mapping Methods -The base class provides `BeforeMap` and `AfterMap` methods that can be overridden to perform actions before and after the mapping. +The base class provides `BeforeMap` and `AfterMap` methods that can be overridden to perform actions before and after the mapping: ````csharp [Mapper] @@ -288,7 +288,7 @@ public partial class UserToUserDtoMapper : TwoWayMapperBase ### Mapping the Object Extensions -[Object extension system](../fundamentals/object-extensions.md) allows to define extra properties for existing classes. ABP provides a mapping definition extension to properly map extra properties of two objects. +[Object extension system](../fundamentals/object-extensions.md) allows to define extra properties for existing classes. ABP provides a mapping definition extension to properly map extra properties of two objects: ````csharp [Mapper] @@ -302,10 +302,11 @@ public partial class UserToUserDtoMapper : MapperBase It is suggested to use the `MapExtraPropertiesAttribute` attribute if both classes are extensible objects (implement the `IHasExtraProperties` interface). See the [object extension document](../fundamentals/object-extensions.md) for more. - ### Lists and Arrays Support -ABP Mapperly integration also supports mapping lists and arrays. Same as [IObjectMapper Interface](#iobjectmappertsource-tdestination-interface) section. Example: +ABP Mapperly integration also supports mapping lists and arrays as explained in the [IObjectMapper Interface](#iobjectmappertsource-tdestination-interface) section. + +**Example**: ````csharp [Mapper] diff --git a/docs/en/release-info/migration-guides/AutoMapper-To-Mapperly.md b/docs/en/release-info/migration-guides/AutoMapper-To-Mapperly.md index 4311d00214..2b0c5b623d 100644 --- a/docs/en/release-info/migration-guides/AutoMapper-To-Mapperly.md +++ b/docs/en/release-info/migration-guides/AutoMapper-To-Mapperly.md @@ -2,27 +2,22 @@ ## Introduction -The AutoMapper library is no longer free for commercial use. See [this article](https://www.jimmybogard.com/automapper-and-mediatr-going-commercial/) for more details. +The AutoMapper library is **no longer free for commercial use**. For more details, you can refer to [this announcement post](https://www.jimmybogard.com/automapper-and-mediatr-going-commercial/). -ABP framework provides the AutoMapper and Mapperly integration. If you have a project that uses AutoMapper and don't have any license for AutoMapper, you can migrate to Mapperly by following the steps below. +ABP Framework provides both AutoMapper and Mapperly integrations. If your project currently uses AutoMapper and you don't have a commercial license, you can switch to Mapperly by following the steps outlined below. ## Migration Steps -Please open your project with the IDE(`Visual Studio`, `VS Code` or `JetBrains Rider`), then perform a global search and replace. - -1. Replace `Volo.Abp.AutoMapper` to `Volo.Abp.Mapperly` in all `*.csproj` files. - -2. Replace `using Volo.Abp.AutoMapper;` to `using Volo.Abp.Mapperly;` in all `*.cs` files. +Please open your project in an IDE(`Visual Studio`, `VS Code` or `JetBrains Rider`), then perform the following global search and replace operations: +1. Replace `Volo.Abp.AutoMapper` with `Volo.Abp.Mapperly` in all `*.csproj` files. +2. Replace `using Volo.Abp.AutoMapper;` with `using Volo.Abp.Mapperly;` in all `*.cs` files. 3. Replace `AbpAutoMapperModule` with `AbpMapperlyModule` in all `*.cs` files. +4. Replace `AddAutoMapperObjectMapper` with `AddMapperlyObjectMapper` in all `*.cs` files. +5. Remove any code sections that configure `Configure`. +6. Review any existing AutoMapper `Profile` classes and ensure all newly created Mapperly mapping classes are registered appropriately. (You can refer to the example below for guidance) -4. Replace `AddAutoMapperObjectMapper` to `AddMapperlyObjectMapper` in all `*.cs` files. - -5. Remove `Configure` code section. - -6. Check the AutoMapper's `Profile` class to add all new Mapperly mapping classes. - -## Example +**Example:** Here is an AutoMapper's `Profile` class: @@ -146,21 +141,19 @@ public partial class IdentityUserToIdentityUserExportDtoMapper : MapperBase @@ -184,7 +177,7 @@ public partial class IdentityUserToIdentityUserDtoMapper : MapperBase