From a9da3689c0226cdc551cab6e2e18ce57cad57fa2 Mon Sep 17 00:00:00 2001 From: maliming Date: Wed, 6 Aug 2025 09:36:28 +0800 Subject: [PATCH] Add documentation for lists and arrays mapping --- .../infrastructure/object-to-object-mapping.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/docs/en/framework/infrastructure/object-to-object-mapping.md b/docs/en/framework/infrastructure/object-to-object-mapping.md index f841907c05..52da7a258a 100644 --- a/docs/en/framework/infrastructure/object-to-object-mapping.md +++ b/docs/en/framework/infrastructure/object-to-object-mapping.md @@ -302,6 +302,23 @@ 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: + +````csharp +[Mapper] +public partial class UserToUserDtoMapper : MapperBase +{ + public override partial UserDto Map(User source); + public override partial void Map(User source, UserDto destination); +} + +var users = await _userRepository.GetListAsync(); // returns List +var dtos = ObjectMapper.Map, List>(users); // creates List +```` + ### More Mapperly Features Most of Mapperly's features such as `Ignore` can be configured through its attributes. See the [Mapperly documentation](https://mapperly.riok.app/docs/intro/) for more details.