diff --git a/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Application/LINGYUN/Abp/DataProtectionManagement/AbpDataProtectionManagementApplicationModule.cs b/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Application/LINGYUN/Abp/DataProtectionManagement/AbpDataProtectionManagementApplicationModule.cs index 58364faf7..4d1bff85c 100644 --- a/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Application/LINGYUN/Abp/DataProtectionManagement/AbpDataProtectionManagementApplicationModule.cs +++ b/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Application/LINGYUN/Abp/DataProtectionManagement/AbpDataProtectionManagementApplicationModule.cs @@ -1,6 +1,5 @@ using Microsoft.Extensions.DependencyInjection; using Volo.Abp.Application; -using Volo.Abp.AutoMapper; using Volo.Abp.Modularity; namespace LINGYUN.Abp.DataProtectionManagement; @@ -13,10 +12,6 @@ public class AbpDataProtectionManagementApplicationModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { - context.Services.AddAutoMapperObjectMapper(); - Configure(options => - { - options.AddProfile(validate: true); - }); + context.Services.AddMapperlyObjectMapper(); } } diff --git a/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Application/LINGYUN/Abp/DataProtectionManagement/DataProtectionManagementApplicationMappers.cs b/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Application/LINGYUN/Abp/DataProtectionManagement/DataProtectionManagementApplicationMappers.cs new file mode 100644 index 000000000..edac92e62 --- /dev/null +++ b/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Application/LINGYUN/Abp/DataProtectionManagement/DataProtectionManagementApplicationMappers.cs @@ -0,0 +1,76 @@ +using Riok.Mapperly.Abstractions; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Volo.Abp.Mapperly; + +namespace LINGYUN.Abp.DataProtectionManagement; + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class EntityEnumInfoToEntityEnumInfoDtoMapper : MapperBase +{ + public override partial EntityEnumInfoDto Map(EntityEnumInfo source); + public override partial void Map(EntityEnumInfo source, EntityEnumInfoDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class EntityPropertyInfoToEntityPropertyInfoDtoMapper : MapperBase +{ + public override partial EntityPropertyInfoDto Map(EntityPropertyInfo source); + public override partial void Map(EntityPropertyInfo source, EntityPropertyInfoDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class EntityTypeInfoToEntityTypeInfoDtoMapper : MapperBase +{ + public override partial EntityTypeInfoDto Map(EntityTypeInfo source); + public override partial void Map(EntityTypeInfo source, EntityTypeInfoDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class RoleEntityRuleToRoleEntityRuleDtoMapper : MapperBase +{ + [MapProperty(nameof(RoleEntityRule.AccessedProperties), nameof(RoleEntityRuleDto.AccessedProperties), Use = nameof(MapToArray))] + public override partial RoleEntityRuleDto Map(RoleEntityRule source); + + [MapProperty(nameof(RoleEntityRule.AccessedProperties), nameof(RoleEntityRuleDto.AccessedProperties), Use = nameof(MapToArray))] + public override partial void Map(RoleEntityRule source, RoleEntityRuleDto destination); + + [UserMapping] + private string[] MapToArray(string val) + { + if (val.IsNullOrWhiteSpace()) + { + return Array.Empty(); + } + return val.Split(',').ToArray(); + } +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class OrganizationUnitEntityRuleToOrganizationUnitEntityRuleDtoMapper : MapperBase +{ + [MapProperty(nameof(OrganizationUnitEntityRule.AccessedProperties), nameof(OrganizationUnitEntityRuleDto.AccessedProperties), Use = nameof(MapToArray))] + public override partial OrganizationUnitEntityRuleDto Map(OrganizationUnitEntityRule source); + + [MapProperty(nameof(OrganizationUnitEntityRule.AccessedProperties), nameof(OrganizationUnitEntityRuleDto.AccessedProperties), Use = nameof(MapToArray))] + public override partial void Map(OrganizationUnitEntityRule source, OrganizationUnitEntityRuleDto destination); + + [UserMapping] + private string[] MapToArray(string val) + { + if (val.IsNullOrWhiteSpace()) + { + return Array.Empty(); + } + return val.Split(',').ToArray(); + } +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class SubjectStrategyToSubjectStrategyDtoMapper : MapperBase +{ + public override partial SubjectStrategyDto Map(SubjectStrategy source); + public override partial void Map(SubjectStrategy source, SubjectStrategyDto destination); +} diff --git a/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Application/LINGYUN/Abp/DataProtectionManagement/DataProtectionManagementApplicationMappingProfile.cs b/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Application/LINGYUN/Abp/DataProtectionManagement/DataProtectionManagementApplicationMappingProfile.cs deleted file mode 100644 index ee944b468..000000000 --- a/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Application/LINGYUN/Abp/DataProtectionManagement/DataProtectionManagementApplicationMappingProfile.cs +++ /dev/null @@ -1,29 +0,0 @@ -using AutoMapper; -using System; -using System.Linq; - -namespace LINGYUN.Abp.DataProtectionManagement; -public class DataProtectionManagementApplicationMappingProfile :Profile -{ - public DataProtectionManagementApplicationMappingProfile() - { - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap() - .ForMember(dto => dto.AccessedProperties, map => map.MapFrom(src => MapToArray(src.AccessedProperties))); - CreateMap() - .ForMember(dto => dto.AccessedProperties, map => map.MapFrom(src => MapToArray(src.AccessedProperties))); - - CreateMap(); - } - - private string[] MapToArray(string val) - { - if (val.IsNullOrWhiteSpace()) - { - return Array.Empty(); - } - return val.Split(',').ToArray(); - } -} diff --git a/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain/LINGYUN.Abp.DataProtectionManagement.Domain.csproj b/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain/LINGYUN.Abp.DataProtectionManagement.Domain.csproj index dd43b8bca..05dcf952e 100644 --- a/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain/LINGYUN.Abp.DataProtectionManagement.Domain.csproj +++ b/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain/LINGYUN.Abp.DataProtectionManagement.Domain.csproj @@ -14,7 +14,7 @@ - + diff --git a/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain/LINGYUN/Abp/DataProtectionManagement/AbpDataProtectionManagementDomainModule.cs b/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain/LINGYUN/Abp/DataProtectionManagement/AbpDataProtectionManagementDomainModule.cs index 56c61eeed..785f9e1a4 100644 --- a/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain/LINGYUN/Abp/DataProtectionManagement/AbpDataProtectionManagementDomainModule.cs +++ b/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain/LINGYUN/Abp/DataProtectionManagement/AbpDataProtectionManagementDomainModule.cs @@ -1,16 +1,14 @@ using LINGYUN.Abp.DataProtection; -using Microsoft.Extensions.Caching.Distributed; using Microsoft.Extensions.DependencyInjection; -using Volo.Abp.AutoMapper; -using Volo.Abp.Caching; using Volo.Abp.Domain; using Volo.Abp.Domain.Entities.Events.Distributed; +using Volo.Abp.Mapperly; using Volo.Abp.Modularity; namespace LINGYUN.Abp.DataProtectionManagement; [DependsOn( - typeof(AbpAutoMapperModule), + typeof(AbpMapperlyModule), typeof(AbpDddDomainModule), typeof(AbpDataProtectionModule), typeof(AbpDataProtectionManagementDomainSharedModule) @@ -19,12 +17,7 @@ public class AbpDataProtectionManagementDomainModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { - context.Services.AddAutoMapperObjectMapper(); - - Configure(options => - { - options.AddProfile(validate: true); - }); + context.Services.AddMapperlyObjectMapper(); Configure(options => { diff --git a/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain/LINGYUN/Abp/DataProtectionManagement/DataProtectionManagementDomainMappers.cs b/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain/LINGYUN/Abp/DataProtectionManagement/DataProtectionManagementDomainMappers.cs new file mode 100644 index 000000000..86fc66484 --- /dev/null +++ b/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain/LINGYUN/Abp/DataProtectionManagement/DataProtectionManagementDomainMappers.cs @@ -0,0 +1,25 @@ +using Riok.Mapperly.Abstractions; +using Volo.Abp.Mapperly; + +namespace LINGYUN.Abp.DataProtectionManagement; + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class EntityTypeInfoToEntityTypeInfoEtoMapper : MapperBase +{ + public override partial EntityTypeInfoEto Map(EntityTypeInfo source); + public override partial void Map(EntityTypeInfo source, EntityTypeInfoEto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class RoleEntityRuleToRoleEntityRuleEtoMapper : MapperBase +{ + public override partial RoleEntityRuleEto Map(RoleEntityRule source); + public override partial void Map(RoleEntityRule source, RoleEntityRuleEto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class OrganizationUnitEntityRuleToOrganizationUnitEntityRuleEtoMapper : MapperBase +{ + public override partial OrganizationUnitEntityRuleEto Map(OrganizationUnitEntityRule source); + public override partial void Map(OrganizationUnitEntityRule source, OrganizationUnitEntityRuleEto destination); +} diff --git a/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain/LINGYUN/Abp/DataProtectionManagement/DataProtectionManagementDomainMappingProfile.cs b/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain/LINGYUN/Abp/DataProtectionManagement/DataProtectionManagementDomainMappingProfile.cs deleted file mode 100644 index b43f3a053..000000000 --- a/aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtectionManagement.Domain/LINGYUN/Abp/DataProtectionManagement/DataProtectionManagementDomainMappingProfile.cs +++ /dev/null @@ -1,12 +0,0 @@ -using AutoMapper; - -namespace LINGYUN.Abp.DataProtectionManagement; -public class DataProtectionManagementDomainMappingProfile : Profile -{ - public DataProtectionManagementDomainMappingProfile() - { - CreateMap(); - CreateMap(); - CreateMap(); - } -}