diff --git a/Directory.Packages.props b/Directory.Packages.props index 7dfa410d2..92b49bd1d 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -277,6 +277,11 @@ + + + + + diff --git a/aspnet-core/framework/auditing/LINGYUN.Abp.AuditLogging.EntityFrameworkCore/LINGYUN/Abp/AuditLogging/EntityFrameworkCore/AbpAuditLoggingEntityFrameworkCoreModule.cs b/aspnet-core/framework/auditing/LINGYUN.Abp.AuditLogging.EntityFrameworkCore/LINGYUN/Abp/AuditLogging/EntityFrameworkCore/AbpAuditLoggingEntityFrameworkCoreModule.cs index 2ca98c940..c5620565f 100644 --- a/aspnet-core/framework/auditing/LINGYUN.Abp.AuditLogging.EntityFrameworkCore/LINGYUN/Abp/AuditLogging/EntityFrameworkCore/AbpAuditLoggingEntityFrameworkCoreModule.cs +++ b/aspnet-core/framework/auditing/LINGYUN.Abp.AuditLogging.EntityFrameworkCore/LINGYUN/Abp/AuditLogging/EntityFrameworkCore/AbpAuditLoggingEntityFrameworkCoreModule.cs @@ -1,5 +1,5 @@ using Microsoft.Extensions.DependencyInjection; -using Volo.Abp.AutoMapper; +using Volo.Abp.Mapperly; using Volo.Abp.Modularity; namespace LINGYUN.Abp.AuditLogging.EntityFrameworkCore; @@ -9,16 +9,11 @@ namespace LINGYUN.Abp.AuditLogging.EntityFrameworkCore; typeof(Volo.Abp.AuditLogging.EntityFrameworkCore.AbpAuditLoggingEntityFrameworkCoreModule))] [DependsOn( typeof(AbpAuditLoggingModule), - typeof(AbpAutoMapperModule))] + typeof(AbpMapperlyModule))] public class AbpAuditLoggingEntityFrameworkCoreModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { - context.Services.AddAutoMapperObjectMapper(); - - Configure(options => - { - options.AddProfile(validate: true); - }); + context.Services.AddMapperlyObjectMapper(); } } diff --git a/aspnet-core/framework/auditing/LINGYUN.Abp.AuditLogging.EntityFrameworkCore/LINGYUN/Abp/AuditLogging/EntityFrameworkCore/AbpAuditingEfCoreMappers.cs b/aspnet-core/framework/auditing/LINGYUN.Abp.AuditLogging.EntityFrameworkCore/LINGYUN/Abp/AuditLogging/EntityFrameworkCore/AbpAuditingEfCoreMappers.cs new file mode 100644 index 000000000..694127a57 --- /dev/null +++ b/aspnet-core/framework/auditing/LINGYUN.Abp.AuditLogging.EntityFrameworkCore/LINGYUN/Abp/AuditLogging/EntityFrameworkCore/AbpAuditingEfCoreMappers.cs @@ -0,0 +1,58 @@ +using Riok.Mapperly.Abstractions; +using Volo.Abp.Identity; +using Volo.Abp.Mapperly; +using Volo.Abp.ObjectExtending; +using VoloAuditLog = Volo.Abp.AuditLogging.AuditLog; +using VoloAuditLogAction = Volo.Abp.AuditLogging.AuditLogAction; +using VoloEntityChange = Volo.Abp.AuditLogging.EntityChange; +using VoloEntityChangeWithUsername = Volo.Abp.AuditLogging.EntityChangeWithUsername; +using VoloEntityPropertyChange = Volo.Abp.AuditLogging.EntityPropertyChange; + +namespace LINGYUN.Abp.AuditLogging.EntityFrameworkCore; + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +[MapExtraProperties(DefinitionChecks = MappingPropertyDefinitionChecks.None)] +public partial class VoloAuditLogActionToAuditLogActionMapper : MapperBase +{ + public override partial AuditLogAction Map(VoloAuditLogAction source); + public override partial void Map(VoloAuditLogAction source, AuditLogAction destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class VoloEntityPropertyChangeToEntityPropertyChangeMapper : MapperBase +{ + public override partial EntityPropertyChange Map(VoloEntityPropertyChange source); + public override partial void Map(VoloEntityPropertyChange source, EntityPropertyChange destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +[MapExtraProperties(DefinitionChecks = MappingPropertyDefinitionChecks.None)] +public partial class VoloEntityChangeToEntityChangeMapper : MapperBase +{ + public override partial EntityChange Map(VoloEntityChange source); + public override partial void Map(VoloEntityChange source, EntityChange destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +[MapExtraProperties(DefinitionChecks = MappingPropertyDefinitionChecks.None)] +public partial class VoloAuditLogToAuditLogMapper : MapperBase +{ + public override partial AuditLog Map(VoloAuditLog source); + public override partial void Map(VoloAuditLog source, AuditLog destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class VoloEntityChangeWithUsernameToEntityChangeWithUsernameMapper : MapperBase +{ + public override partial EntityChangeWithUsername Map(VoloEntityChangeWithUsername source); + public override partial void Map(VoloEntityChangeWithUsername source, EntityChangeWithUsername destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +[MapExtraProperties(DefinitionChecks = MappingPropertyDefinitionChecks.None)] +public partial class IdentitySecurityLogToSecurityLogMapper : MapperBase +{ + public override partial SecurityLog Map(IdentitySecurityLog source); + public override partial void Map(IdentitySecurityLog source, SecurityLog destination); +} + diff --git a/aspnet-core/framework/auditing/LINGYUN.Abp.AuditLogging.EntityFrameworkCore/LINGYUN/Abp/AuditLogging/EntityFrameworkCore/AbpAuditingMapperProfile.cs b/aspnet-core/framework/auditing/LINGYUN.Abp.AuditLogging.EntityFrameworkCore/LINGYUN/Abp/AuditLogging/EntityFrameworkCore/AbpAuditingMapperProfile.cs deleted file mode 100644 index 091801817..000000000 --- a/aspnet-core/framework/auditing/LINGYUN.Abp.AuditLogging.EntityFrameworkCore/LINGYUN/Abp/AuditLogging/EntityFrameworkCore/AbpAuditingMapperProfile.cs +++ /dev/null @@ -1,23 +0,0 @@ -using AutoMapper; -using Volo.Abp.ObjectExtending; - -namespace LINGYUN.Abp.AuditLogging.EntityFrameworkCore; - -public class AbpAuditingMapperProfile : Profile -{ - public AbpAuditingMapperProfile() - { - CreateMap() - .MapExtraProperties(MappingPropertyDefinitionChecks.None); - CreateMap(); - CreateMap() - .MapExtraProperties(MappingPropertyDefinitionChecks.None); - CreateMap() - .MapExtraProperties(MappingPropertyDefinitionChecks.None); - - CreateMap(); - - CreateMap(MemberList.Destination) - .MapExtraProperties(MappingPropertyDefinitionChecks.None); - } -} diff --git a/aspnet-core/framework/dapr/LINGYUN.Abp.DistributedLocking.Dapr/LINGYUN/Abp/DistributedLocking/Dapr/DaprAbpDistributedLockHandle.cs b/aspnet-core/framework/dapr/LINGYUN.Abp.DistributedLocking.Dapr/LINGYUN/Abp/DistributedLocking/Dapr/DaprAbpDistributedLockHandle.cs index 0bb164cc6..a6be4c875 100644 --- a/aspnet-core/framework/dapr/LINGYUN.Abp.DistributedLocking.Dapr/LINGYUN/Abp/DistributedLocking/Dapr/DaprAbpDistributedLockHandle.cs +++ b/aspnet-core/framework/dapr/LINGYUN.Abp.DistributedLocking.Dapr/LINGYUN/Abp/DistributedLocking/Dapr/DaprAbpDistributedLockHandle.cs @@ -23,6 +23,8 @@ public class DaprAbpDistributedLockHandle : IAbpDistributedLockHandle } public async ValueTask DisposeAsync() { +#pragma warning disable DAPR_DISTRIBUTEDLOCK await DaprClient.Unlock(StoreName, ResourceId, LockOwner); +#pragma warning restore DAPR_DISTRIBUTEDLOCK } } diff --git a/aspnet-core/framework/entity-change/LINGYUN.Abp.EntityChange.Application/LINGYUN/Abp/EntityChange/AbpEntityChangeApplicationMapper.cs b/aspnet-core/framework/entity-change/LINGYUN.Abp.EntityChange.Application/LINGYUN/Abp/EntityChange/AbpEntityChangeApplicationMapper.cs new file mode 100644 index 000000000..67869b179 --- /dev/null +++ b/aspnet-core/framework/entity-change/LINGYUN.Abp.EntityChange.Application/LINGYUN/Abp/EntityChange/AbpEntityChangeApplicationMapper.cs @@ -0,0 +1,20 @@ +using LINGYUN.Abp.AuditLogging; +using Riok.Mapperly.Abstractions; +using Volo.Abp.Mapperly; + +namespace LINGYUN.Abp.EntityChange; + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class EntityPropertyChangeToEntityPropertyChangeDtoMapper : MapperBase +{ + public override partial EntityPropertyChangeDto Map(EntityPropertyChange source); + public override partial void Map(EntityPropertyChange source, EntityPropertyChangeDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +[MapExtraProperties] +public partial class EntityChangeToEntityChangeDtoMapper : MapperBase +{ + public override partial EntityChangeDto Map(AuditLogging.EntityChange source); + public override partial void Map(AuditLogging.EntityChange source, EntityChangeDto destination); +} diff --git a/aspnet-core/framework/entity-change/LINGYUN.Abp.EntityChange.Application/LINGYUN/Abp/EntityChange/AbpEntityChangeApplicationModule.cs b/aspnet-core/framework/entity-change/LINGYUN.Abp.EntityChange.Application/LINGYUN/Abp/EntityChange/AbpEntityChangeApplicationModule.cs index 1922b0c47..42b4256e2 100644 --- a/aspnet-core/framework/entity-change/LINGYUN.Abp.EntityChange.Application/LINGYUN/Abp/EntityChange/AbpEntityChangeApplicationModule.cs +++ b/aspnet-core/framework/entity-change/LINGYUN.Abp.EntityChange.Application/LINGYUN/Abp/EntityChange/AbpEntityChangeApplicationModule.cs @@ -1,6 +1,6 @@ using Microsoft.Extensions.DependencyInjection; using Volo.Abp.Application; -using Volo.Abp.AutoMapper; +using Volo.Abp.Mapperly; using Volo.Abp.Modularity; namespace LINGYUN.Abp.EntityChange; @@ -8,16 +8,11 @@ namespace LINGYUN.Abp.EntityChange; [DependsOn( typeof(AbpEntityChangeApplicationContractsModule), typeof(AbpDddApplicationModule), - typeof(AbpAutoMapperModule))] + typeof(AbpMapperlyModule))] public class AbpEntityChangeApplicationModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { - context.Services.AddAutoMapperObjectMapper(); - - Configure(options => - { - options.AddProfile(validate: true); - }); + context.Services.AddMapperlyObjectMapper(); } } diff --git a/aspnet-core/framework/entity-change/LINGYUN.Abp.EntityChange.Application/LINGYUN/Abp/EntityChange/AbpEntityChangeMapperProfile.cs b/aspnet-core/framework/entity-change/LINGYUN.Abp.EntityChange.Application/LINGYUN/Abp/EntityChange/AbpEntityChangeMapperProfile.cs deleted file mode 100644 index 59d61ab95..000000000 --- a/aspnet-core/framework/entity-change/LINGYUN.Abp.EntityChange.Application/LINGYUN/Abp/EntityChange/AbpEntityChangeMapperProfile.cs +++ /dev/null @@ -1,13 +0,0 @@ -using AutoMapper; -using LINGYUN.Abp.AuditLogging; - -namespace LINGYUN.Abp.EntityChange; -public class AbpEntityChangeMapperProfile : Profile -{ - public AbpEntityChangeMapperProfile() - { - CreateMap(); - CreateMap() - .MapExtraProperties(); - } -} diff --git a/aspnet-core/framework/logging/LINGYUN.Abp.Logging.Serilog.Elasticsearch/LINGYUN/Abp/AuditLogging/Serilog/Elasticsearch/AbpLoggingSerilogElasticsearchMapperProfile.cs b/aspnet-core/framework/logging/LINGYUN.Abp.Logging.Serilog.Elasticsearch/LINGYUN/Abp/AuditLogging/Serilog/Elasticsearch/AbpLoggingSerilogElasticsearchMapperProfile.cs deleted file mode 100644 index 3618d88a4..000000000 --- a/aspnet-core/framework/logging/LINGYUN.Abp.Logging.Serilog.Elasticsearch/LINGYUN/Abp/AuditLogging/Serilog/Elasticsearch/AbpLoggingSerilogElasticsearchMapperProfile.cs +++ /dev/null @@ -1,29 +0,0 @@ -using AutoMapper; -using Serilog.Events; - -namespace LINGYUN.Abp.Logging.Serilog.Elasticsearch; - -public class AbpLoggingSerilogElasticsearchMapperProfile : Profile -{ - public AbpLoggingSerilogElasticsearchMapperProfile() - { - CreateMap(); - CreateMap() - .ForMember(log => log.Id, map => map.MapFrom(slog => slog.UniqueId.ToString())); - CreateMap() - .ForMember(log => log.Level, map => map.MapFrom(slog => GetLogLevel(slog.Level))); - } - - private static Microsoft.Extensions.Logging.LogLevel GetLogLevel(LogEventLevel logEventLevel) - { - return logEventLevel switch - { - LogEventLevel.Fatal => Microsoft.Extensions.Logging.LogLevel.Critical, - LogEventLevel.Error => Microsoft.Extensions.Logging.LogLevel.Error, - LogEventLevel.Warning => Microsoft.Extensions.Logging.LogLevel.Warning, - LogEventLevel.Information => Microsoft.Extensions.Logging.LogLevel.Information, - LogEventLevel.Debug => Microsoft.Extensions.Logging.LogLevel.Debug, - _ => Microsoft.Extensions.Logging.LogLevel.Trace, - }; - } -} diff --git a/aspnet-core/framework/logging/LINGYUN.Abp.Logging.Serilog.Elasticsearch/LINGYUN/Abp/AuditLogging/Serilog/Elasticsearch/AbpLoggingSerilogElasticsearchMappers.cs b/aspnet-core/framework/logging/LINGYUN.Abp.Logging.Serilog.Elasticsearch/LINGYUN/Abp/AuditLogging/Serilog/Elasticsearch/AbpLoggingSerilogElasticsearchMappers.cs new file mode 100644 index 000000000..54e7c4871 --- /dev/null +++ b/aspnet-core/framework/logging/LINGYUN.Abp.Logging.Serilog.Elasticsearch/LINGYUN/Abp/AuditLogging/Serilog/Elasticsearch/AbpLoggingSerilogElasticsearchMappers.cs @@ -0,0 +1,53 @@ +using LINGYUN.Abp.Logging; +using LINGYUN.Abp.Logging.Serilog.Elasticsearch; +using Riok.Mapperly.Abstractions; +using Serilog.Events; +using Volo.Abp.Mapperly; + +namespace LINGYUN.Abp.AuditLogging.Serilog.Elasticsearch; + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class SerilogExceptionToLogExceptionMapper : MapperBase +{ + public override partial LogException Map(SerilogException source); + public override partial void Map(SerilogException source, LogException destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class SerilogFieldToLogFieldMapper : MapperBase +{ + [MapperIgnoreTarget(nameof(LogField.Id))] + public override partial LogField Map(SerilogField source); + + [MapperIgnoreTarget(nameof(LogField.Id))] + public override partial void Map(SerilogField source, LogField destination); + + public override void AfterMap(SerilogField source, LogField destination) + { + destination.Id = source.UniqueId.ToString(); + } +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class SerilogInfoToLogInfoMapper : MapperBase +{ + [MapPropertyFromSource(nameof(LogInfo.Level), Use = nameof(GetLogLevel))] + public override partial LogInfo Map(SerilogInfo source); + + [MapPropertyFromSource(nameof(LogInfo.Level), Use = nameof(GetLogLevel))] + public override partial void Map(SerilogInfo source, LogInfo destination); + + [UserMapping(Default = false)] + private static Microsoft.Extensions.Logging.LogLevel GetLogLevel(SerilogInfo source) + { + return source.Level switch + { + LogEventLevel.Fatal => Microsoft.Extensions.Logging.LogLevel.Critical, + LogEventLevel.Error => Microsoft.Extensions.Logging.LogLevel.Error, + LogEventLevel.Warning => Microsoft.Extensions.Logging.LogLevel.Warning, + LogEventLevel.Information => Microsoft.Extensions.Logging.LogLevel.Information, + LogEventLevel.Debug => Microsoft.Extensions.Logging.LogLevel.Debug, + _ => Microsoft.Extensions.Logging.LogLevel.Trace, + }; + } +} diff --git a/aspnet-core/framework/logging/LINGYUN.Abp.Logging.Serilog.Elasticsearch/LINGYUN/Abp/AuditLogging/Serilog/Elasticsearch/AbpLoggingSerilogElasticsearchModule.cs b/aspnet-core/framework/logging/LINGYUN.Abp.Logging.Serilog.Elasticsearch/LINGYUN/Abp/AuditLogging/Serilog/Elasticsearch/AbpLoggingSerilogElasticsearchModule.cs index 8f9f7b273..391e1deb5 100644 --- a/aspnet-core/framework/logging/LINGYUN.Abp.Logging.Serilog.Elasticsearch/LINGYUN/Abp/AuditLogging/Serilog/Elasticsearch/AbpLoggingSerilogElasticsearchModule.cs +++ b/aspnet-core/framework/logging/LINGYUN.Abp.Logging.Serilog.Elasticsearch/LINGYUN/Abp/AuditLogging/Serilog/Elasticsearch/AbpLoggingSerilogElasticsearchModule.cs @@ -1,7 +1,7 @@ using LINGYUN.Abp.Elasticsearch; using Microsoft.Extensions.DependencyInjection; -using Volo.Abp.AutoMapper; using Volo.Abp.Json; +using Volo.Abp.Mapperly; using Volo.Abp.Modularity; namespace LINGYUN.Abp.Logging.Serilog.Elasticsearch; @@ -9,7 +9,7 @@ namespace LINGYUN.Abp.Logging.Serilog.Elasticsearch; [DependsOn( typeof(AbpLoggingModule), typeof(AbpElasticsearchModule), - typeof(AbpAutoMapperModule), + typeof(AbpMapperlyModule), typeof(AbpJsonModule))] public class AbpLoggingSerilogElasticsearchModule : AbpModule { @@ -19,11 +19,6 @@ public class AbpLoggingSerilogElasticsearchModule : AbpModule Configure(configuration.GetSection("Logging:Serilog:Elasticsearch")); - context.Services.AddAutoMapperObjectMapper(); - - Configure(options => - { - options.AddProfile(validate: true); - }); + context.Services.AddMapperlyObjectMapper(); } } diff --git a/aspnet-core/migrations/LY.MicroService.Applications.Single.DbMigrator/LY.MicroService.Applications.Single.DbMigrator.csproj b/aspnet-core/migrations/LY.MicroService.Applications.Single.DbMigrator/LY.MicroService.Applications.Single.DbMigrator.csproj index 7fc007c25..2a2277016 100644 --- a/aspnet-core/migrations/LY.MicroService.Applications.Single.DbMigrator/LY.MicroService.Applications.Single.DbMigrator.csproj +++ b/aspnet-core/migrations/LY.MicroService.Applications.Single.DbMigrator/LY.MicroService.Applications.Single.DbMigrator.csproj @@ -13,11 +13,6 @@ - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - diff --git a/aspnet-core/migrations/LY.MicroService.Applications.Single.EntityFrameworkCore.MySql/LY.MicroService.Applications.Single.EntityFrameworkCore.MySql.csproj b/aspnet-core/migrations/LY.MicroService.Applications.Single.EntityFrameworkCore.MySql/LY.MicroService.Applications.Single.EntityFrameworkCore.MySql.csproj index 1409dab0f..81d923389 100644 --- a/aspnet-core/migrations/LY.MicroService.Applications.Single.EntityFrameworkCore.MySql/LY.MicroService.Applications.Single.EntityFrameworkCore.MySql.csproj +++ b/aspnet-core/migrations/LY.MicroService.Applications.Single.EntityFrameworkCore.MySql/LY.MicroService.Applications.Single.EntityFrameworkCore.MySql.csproj @@ -12,6 +12,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/aspnet-core/migrations/LY.MicroService.Applications.Single.EntityFrameworkCore.MySql/SingleMigrationsEntityFrameworkCoreMySqlModule.cs b/aspnet-core/migrations/LY.MicroService.Applications.Single.EntityFrameworkCore.MySql/SingleMigrationsEntityFrameworkCoreMySqlModule.cs index ef08a9f80..0df2ab0cf 100644 --- a/aspnet-core/migrations/LY.MicroService.Applications.Single.EntityFrameworkCore.MySql/SingleMigrationsEntityFrameworkCoreMySqlModule.cs +++ b/aspnet-core/migrations/LY.MicroService.Applications.Single.EntityFrameworkCore.MySql/SingleMigrationsEntityFrameworkCoreMySqlModule.cs @@ -53,7 +53,9 @@ public class SingleMigrationsEntityFrameworkCoreMySqlModule : AbpModule mysql => { // see: https://github.com/PomeloFoundation/Pomelo.EntityFrameworkCore.MySql/issues/1960 +#pragma warning disable CS0618 mysql.TranslateParameterizedCollectionsToConstants(); +#pragma warning restore CS0618 mysql.MigrationsAssembly(GetType().Assembly); }); }); diff --git a/aspnet-core/migrations/LY.MicroService.Applications.Single.EntityFrameworkCore/SingleMigrationsDbContext.cs b/aspnet-core/migrations/LY.MicroService.Applications.Single.EntityFrameworkCore/SingleMigrationsDbContext.cs index 386520e6d..b94ad4f4b 100644 --- a/aspnet-core/migrations/LY.MicroService.Applications.Single.EntityFrameworkCore/SingleMigrationsDbContext.cs +++ b/aspnet-core/migrations/LY.MicroService.Applications.Single.EntityFrameworkCore/SingleMigrationsDbContext.cs @@ -155,6 +155,8 @@ public class SingleMigrationsDbContext : public DbSet BackgroundJobAction { get; set; } + public DbSet BackgroundJobLogs { get; set; } + public DbSet WebhookSendRecord { get; set; } public DbSet WebhookGroupDefinitionRecords { get; set; } diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/AbpAccountApplicationMapper.cs b/aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/AbpAccountApplicationMapper.cs new file mode 100644 index 000000000..1a085851e --- /dev/null +++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/AbpAccountApplicationMapper.cs @@ -0,0 +1,13 @@ +using LINGYUN.Abp.AuditLogging; +using Riok.Mapperly.Abstractions; +using Volo.Abp.Mapperly; + +namespace LINGYUN.Abp.Account; + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class SecurityLogToSecurityLogDtoMapper : MapperBase +{ + public override partial SecurityLogDto Map(SecurityLog source); + public override partial void Map(SecurityLog source, SecurityLogDto destination); +} + diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/AbpAccountApplicationModule.cs b/aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/AbpAccountApplicationModule.cs index ef781343e..5ed0e651f 100644 --- a/aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/AbpAccountApplicationModule.cs +++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/AbpAccountApplicationModule.cs @@ -4,7 +4,6 @@ using LINGYUN.Abp.Identity; using LINGYUN.Abp.WeChat.MiniProgram; using Microsoft.Extensions.DependencyInjection; using Volo.Abp.Account.Localization; -using Volo.Abp.AutoMapper; using Volo.Abp.BlobStoring; using Volo.Abp.Localization; using Volo.Abp.Modularity; @@ -24,12 +23,7 @@ public class AbpAccountApplicationModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { - context.Services.AddAutoMapperObjectMapper(); - - Configure(options => - { - options.AddMaps(validate: true); - }); + context.Services.AddMapperlyObjectMapper(); Configure(options => { diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/AbpAccountMapperProfile.cs b/aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/AbpAccountMapperProfile.cs deleted file mode 100644 index ee907f377..000000000 --- a/aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/AbpAccountMapperProfile.cs +++ /dev/null @@ -1,12 +0,0 @@ -using AutoMapper; -using LINGYUN.Abp.AuditLogging; - -namespace LINGYUN.Abp.Account; - -public class AbpAccountMapperProfile : Profile -{ - public AbpAccountMapperProfile() - { - CreateMap(MemberList.Destination); - } -} diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.Web.IdentityServer/LINGYUN.Abp.Account.Web.IdentityServer.csproj b/aspnet-core/modules/account/LINGYUN.Abp.Account.Web.IdentityServer/LINGYUN.Abp.Account.Web.IdentityServer.csproj index 560bba715..342d41abd 100644 --- a/aspnet-core/modules/account/LINGYUN.Abp.Account.Web.IdentityServer/LINGYUN.Abp.Account.Web.IdentityServer.csproj +++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.Web.IdentityServer/LINGYUN.Abp.Account.Web.IdentityServer.csproj @@ -16,6 +16,7 @@ + diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/AbpAccountWebModule.cs b/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/AbpAccountWebModule.cs index 115c671d4..bc43954a7 100644 --- a/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/AbpAccountWebModule.cs +++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/AbpAccountWebModule.cs @@ -14,7 +14,6 @@ using Volo.Abp.Account.Web.ProfileManagement; using Volo.Abp.AspNetCore.Mvc.Localization; using Volo.Abp.AspNetCore.Mvc.UI.Bundling; using Volo.Abp.AspNetCore.Mvc.UI.Packages.QRCode; -using Volo.Abp.AutoMapper; using Volo.Abp.Modularity; using Volo.Abp.Sms; using Volo.Abp.VirtualFileSystem; @@ -53,11 +52,7 @@ public class AbpAccountWebModule : AbpModule ConfigureProfileManagementPage(); - context.Services.AddAutoMapperObjectMapper(); - Configure(options => - { - options.AddMaps(validate: true); - }); + context.Services.AddMapperlyObjectMapper(); context.Services .AddAuthentication() diff --git a/aspnet-core/modules/auditing/LINGYUN.Abp.Auditing.Application/LINGYUN.Abp.Auditing.Application.csproj b/aspnet-core/modules/auditing/LINGYUN.Abp.Auditing.Application/LINGYUN.Abp.Auditing.Application.csproj index a73d2efbb..79a6b224a 100644 --- a/aspnet-core/modules/auditing/LINGYUN.Abp.Auditing.Application/LINGYUN.Abp.Auditing.Application.csproj +++ b/aspnet-core/modules/auditing/LINGYUN.Abp.Auditing.Application/LINGYUN.Abp.Auditing.Application.csproj @@ -14,7 +14,7 @@ - + diff --git a/aspnet-core/modules/auditing/LINGYUN.Abp.Auditing.Application/LINGYUN/Abp/Auditing/AbpAuditingApplicationMappers.cs b/aspnet-core/modules/auditing/LINGYUN.Abp.Auditing.Application/LINGYUN/Abp/Auditing/AbpAuditingApplicationMappers.cs new file mode 100644 index 000000000..68818334f --- /dev/null +++ b/aspnet-core/modules/auditing/LINGYUN.Abp.Auditing.Application/LINGYUN/Abp/Auditing/AbpAuditingApplicationMappers.cs @@ -0,0 +1,77 @@ +using LINGYUN.Abp.Auditing.AuditLogs; +using LINGYUN.Abp.Auditing.Logging; +using LINGYUN.Abp.Auditing.SecurityLogs; +using LINGYUN.Abp.AuditLogging; +using LINGYUN.Abp.Logging; +using Riok.Mapperly.Abstractions; +using Volo.Abp.Mapperly; +using Volo.Abp.ObjectExtending; + +namespace LINGYUN.Abp.Auditing; + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +[MapExtraProperties(DefinitionChecks = MappingPropertyDefinitionChecks.None)] +public partial class AuditLogActionToAuditLogActionDtoMapper : MapperBase +{ + public override partial AuditLogActionDto Map(AuditLogAction source); + public override partial void Map(AuditLogAction source, AuditLogActionDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class EntityPropertyChangeToEntityPropertyChangeDtoMapper : MapperBase +{ + public override partial EntityPropertyChangeDto Map(EntityPropertyChange source); + public override partial void Map(EntityPropertyChange source, EntityPropertyChangeDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class EntityChangeWithUsernameToEntityChangeWithUsernameDtoMapper : MapperBase +{ + public override partial EntityChangeWithUsernameDto Map(EntityChangeWithUsername source); + public override partial void Map(EntityChangeWithUsername source, EntityChangeWithUsernameDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +[MapExtraProperties(DefinitionChecks = MappingPropertyDefinitionChecks.None)] +public partial class EntityChangeToEntityChangeDtoMapper : MapperBase +{ + public override partial EntityChangeDto Map(EntityChange source); + public override partial void Map(EntityChange source, EntityChangeDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +[MapExtraProperties(DefinitionChecks = MappingPropertyDefinitionChecks.None)] +public partial class AuditLogToAuditLogDtoMapper : MapperBase +{ + public override partial AuditLogDto Map(AuditLog source); + public override partial void Map(AuditLog source, AuditLogDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +[MapExtraProperties(DefinitionChecks = MappingPropertyDefinitionChecks.None)] +public partial class SecurityLogToSecurityLogDtoMapper : MapperBase +{ + public override partial SecurityLogDto Map(SecurityLog source); + public override partial void Map(SecurityLog source, SecurityLogDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class LogFieldToLogFieldDtoMapper : MapperBase +{ + public override partial LogFieldDto Map(LogField source); + public override partial void Map(LogField source, LogFieldDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class LogExceptionToLogExceptionDtoMapper : MapperBase +{ + public override partial LogExceptionDto Map(LogException source); + public override partial void Map(LogException source, LogExceptionDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class LogInfoToLogDtoMapper : MapperBase +{ + public override partial LogDto Map(LogInfo source); + public override partial void Map(LogInfo source, LogDto destination); +} diff --git a/aspnet-core/modules/auditing/LINGYUN.Abp.Auditing.Application/LINGYUN/Abp/Auditing/AbpAuditingApplicationModule.cs b/aspnet-core/modules/auditing/LINGYUN.Abp.Auditing.Application/LINGYUN/Abp/Auditing/AbpAuditingApplicationModule.cs index f10dd4836..5692e4b19 100644 --- a/aspnet-core/modules/auditing/LINGYUN.Abp.Auditing.Application/LINGYUN/Abp/Auditing/AbpAuditingApplicationModule.cs +++ b/aspnet-core/modules/auditing/LINGYUN.Abp.Auditing.Application/LINGYUN/Abp/Auditing/AbpAuditingApplicationModule.cs @@ -1,13 +1,13 @@ using LINGYUN.Abp.AuditLogging; using LINGYUN.Abp.Logging; using Microsoft.Extensions.DependencyInjection; -using Volo.Abp.AutoMapper; +using Volo.Abp.Mapperly; using Volo.Abp.Modularity; namespace LINGYUN.Abp.Auditing; [DependsOn( - typeof(AbpAutoMapperModule), + typeof(AbpMapperlyModule), typeof(AbpLoggingModule), typeof(AbpAuditLoggingModule), typeof(AbpAuditingApplicationContractsModule))] @@ -15,11 +15,6 @@ public class AbpAuditingApplicationModule : 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/auditing/LINGYUN.Abp.Auditing.Application/LINGYUN/Abp/Auditing/AbpAuditingMapperProfile.cs b/aspnet-core/modules/auditing/LINGYUN.Abp.Auditing.Application/LINGYUN/Abp/Auditing/AbpAuditingMapperProfile.cs deleted file mode 100644 index ce9ec0ee3..000000000 --- a/aspnet-core/modules/auditing/LINGYUN.Abp.Auditing.Application/LINGYUN/Abp/Auditing/AbpAuditingMapperProfile.cs +++ /dev/null @@ -1,31 +0,0 @@ -using AutoMapper; -using LINGYUN.Abp.Auditing.AuditLogs; -using LINGYUN.Abp.Auditing.Logging; -using LINGYUN.Abp.Auditing.SecurityLogs; -using LINGYUN.Abp.AuditLogging; -using LINGYUN.Abp.Logging; -using Volo.Abp.ObjectExtending; - -namespace LINGYUN.Abp.Auditing; - -public class AbpAuditingMapperProfile : Profile -{ - public AbpAuditingMapperProfile() - { - CreateMap() - .MapExtraProperties(MappingPropertyDefinitionChecks.None); - CreateMap(); - CreateMap(); - CreateMap() - .MapExtraProperties(MappingPropertyDefinitionChecks.None); - CreateMap() - .MapExtraProperties(MappingPropertyDefinitionChecks.None); - - CreateMap(MemberList.Destination) - .MapExtraProperties(MappingPropertyDefinitionChecks.None); - - CreateMap(); - CreateMap(); - CreateMap(); - } -} diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application/LINGYUN/Abp/Demo/AbpDemoApplicationModule.cs b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application/LINGYUN/Abp/Demo/AbpDemoApplicationModule.cs index b0eed876f..d04b3d607 100644 --- a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application/LINGYUN/Abp/Demo/AbpDemoApplicationModule.cs +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application/LINGYUN/Abp/Demo/AbpDemoApplicationModule.cs @@ -2,7 +2,6 @@ using LINGYUN.Abp.Exporter; using Microsoft.Extensions.DependencyInjection; using Volo.Abp.Application; -using Volo.Abp.AutoMapper; using Volo.Abp.Modularity; namespace LINGYUN.Abp.Demo; @@ -17,11 +16,6 @@ public class AbpDemoApplicationModule : 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/demo/LINGYUN.Abp.Demo.Application/LINGYUN/Abp/Demo/DemoApplicationMapperProfile.cs b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application/LINGYUN/Abp/Demo/DemoApplicationMapperProfile.cs deleted file mode 100644 index 15d60a2ea..000000000 --- a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application/LINGYUN/Abp/Demo/DemoApplicationMapperProfile.cs +++ /dev/null @@ -1,26 +0,0 @@ -using AutoMapper; -using LINGYUN.Abp.Demo.Authors; -using LINGYUN.Abp.Demo.Books; -using Volo.Abp.AutoMapper; - -namespace LINGYUN.Abp.Demo; -public class DemoApplicationMapperProfile : Profile -{ - public DemoApplicationMapperProfile() - { - CreateMap() - .Ignore(dto => dto.AuthorName); - CreateMap() - .IgnoreAuditedObjectProperties() - .Ignore(dto => dto.Id) - .Ignore(dto => dto.ExtraProperties) - .Ignore(dto => dto.ConcurrencyStamp); - CreateMap() - .IgnoreAuditedObjectProperties() - .Ignore(dto => dto.Id) - .Ignore(dto => dto.ExtraProperties) - .Ignore(dto => dto.ConcurrencyStamp); - CreateMap(); - CreateMap(); - } -} diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application/LINGYUN/Abp/Demo/DemoApplicationMappers.cs b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application/LINGYUN/Abp/Demo/DemoApplicationMappers.cs new file mode 100644 index 000000000..7568aea1b --- /dev/null +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Application/LINGYUN/Abp/Demo/DemoApplicationMappers.cs @@ -0,0 +1,30 @@ +using LINGYUN.Abp.Demo.Authors; +using LINGYUN.Abp.Demo.Books; +using Riok.Mapperly.Abstractions; +using Volo.Abp.Mapperly; + +namespace LINGYUN.Abp.Demo; + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class BookToBookDtoMapper : MapperBase +{ + [MapperIgnoreTarget(nameof(BookDto.AuthorName))] + public override partial BookDto Map(Book source); + + [MapperIgnoreTarget(nameof(BookDto.AuthorName))] + public override partial void Map(Book source, BookDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class AuthorToAuthorDtoMapper : MapperBase +{ + public override partial AuthorDto Map(Author source); + public override partial void Map(Author source, AuthorDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class AuthorToAuthorLookupDtoMapper : MapperBase +{ + public override partial AuthorLookupDto Map(Author source); + public override partial void Map(Author source, AuthorLookupDto destination); +} diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain/LINGYUN.Abp.Demo.Domain.csproj b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain/LINGYUN.Abp.Demo.Domain.csproj index 39eb9d5d7..fbd6465e9 100644 --- a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain/LINGYUN.Abp.Demo.Domain.csproj +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain/LINGYUN.Abp.Demo.Domain.csproj @@ -16,7 +16,7 @@ - + diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain/LINGYUN/Abp/Demo/AbpDemoDomainModule.cs b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain/LINGYUN/Abp/Demo/AbpDemoDomainModule.cs index 6391d7c87..04534f608 100644 --- a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain/LINGYUN/Abp/Demo/AbpDemoDomainModule.cs +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain/LINGYUN/Abp/Demo/AbpDemoDomainModule.cs @@ -3,15 +3,15 @@ using LINGYUN.Abp.DataProtection.Localization; using LINGYUN.Abp.Demo.Books; using LINGYUN.Abp.Demo.Localization; using Microsoft.Extensions.DependencyInjection; -using Volo.Abp.AutoMapper; using Volo.Abp.Domain; using Volo.Abp.Localization; +using Volo.Abp.Mapperly; using Volo.Abp.Modularity; namespace LINGYUN.Abp.Demo; [DependsOn( - typeof(AbpAutoMapperModule), + typeof(AbpMapperlyModule), typeof(AbpDddDomainModule), typeof(AbpDataProtectionModule), typeof(AbpDemoDomainSharedModule))] @@ -19,12 +19,7 @@ public class AbpDemoDomainModule : 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/demo/LINGYUN.Abp.Demo.Domain/LINGYUN/Abp/Demo/DemoDomainMapperProfile.cs b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain/LINGYUN/Abp/Demo/DemoDomainMapperProfile.cs deleted file mode 100644 index fc0624887..000000000 --- a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.Domain/LINGYUN/Abp/Demo/DemoDomainMapperProfile.cs +++ /dev/null @@ -1,10 +0,0 @@ -using AutoMapper; - -namespace LINGYUN.Abp.Demo; -public class DemoDomainMapperProfile : Profile -{ - public DemoDomainMapperProfile() - { - - } -} diff --git a/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.EntityFrameworkCore.MySql/LINGYUN.Abp.Elsa.EntityFrameworkCore.MySql.csproj b/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.EntityFrameworkCore.MySql/LINGYUN.Abp.Elsa.EntityFrameworkCore.MySql.csproj index 2b56455e5..5432ef837 100644 --- a/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.EntityFrameworkCore.MySql/LINGYUN.Abp.Elsa.EntityFrameworkCore.MySql.csproj +++ b/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.EntityFrameworkCore.MySql/LINGYUN.Abp.Elsa.EntityFrameworkCore.MySql.csproj @@ -22,6 +22,7 @@ + diff --git a/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.EntityFrameworkCore.MySql/LINGYUN/Abp/Elsa/EntityFrameworkCore/MySql/PersistenceStartup.cs b/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.EntityFrameworkCore.MySql/LINGYUN/Abp/Elsa/EntityFrameworkCore/MySql/PersistenceStartup.cs index 51dd4cd4f..a0dab5bd1 100644 --- a/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.EntityFrameworkCore.MySql/LINGYUN/Abp/Elsa/EntityFrameworkCore/MySql/PersistenceStartup.cs +++ b/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.EntityFrameworkCore.MySql/LINGYUN/Abp/Elsa/EntityFrameworkCore/MySql/PersistenceStartup.cs @@ -11,9 +11,11 @@ public class PersistenceStartup : PersistenceStartupBase protected override void Configure(DbContextOptionsBuilder options, string connectionString) { +#pragma warning disable CS0618 options.UseMySql( connectionString, ServerVersion.AutoDetect(connectionString), mysql => mysql.TranslateParameterizedCollectionsToConstants()); +#pragma warning restore CS0618 } } diff --git a/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.EntityFrameworkCore.MySql/LINGYUN/Abp/Elsa/EntityFrameworkCore/MySql/WebhooksStartup.cs b/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.EntityFrameworkCore.MySql/LINGYUN/Abp/Elsa/EntityFrameworkCore/MySql/WebhooksStartup.cs index c5948acb0..55751e40a 100644 --- a/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.EntityFrameworkCore.MySql/LINGYUN/Abp/Elsa/EntityFrameworkCore/MySql/WebhooksStartup.cs +++ b/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.EntityFrameworkCore.MySql/LINGYUN/Abp/Elsa/EntityFrameworkCore/MySql/WebhooksStartup.cs @@ -10,10 +10,12 @@ public class WebhooksStartup : WebhooksStartupBase protected override void Configure(DbContextOptionsBuilder options, string connectionString) { +#pragma warning disable CS0618 options.UseMySql( connectionString, ServerVersion.AutoDetect(connectionString), mysql => mysql.MigrationsHistoryTable("__EFMigrationsHistory_Webhooks") .TranslateParameterizedCollectionsToConstants()); +#pragma warning restore CS0618 } } diff --git a/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.EntityFrameworkCore.MySql/LINGYUN/Abp/Elsa/EntityFrameworkCore/MySql/WorkflowSettingsStartup.cs b/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.EntityFrameworkCore.MySql/LINGYUN/Abp/Elsa/EntityFrameworkCore/MySql/WorkflowSettingsStartup.cs index 8bdd4594c..60b78821d 100644 --- a/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.EntityFrameworkCore.MySql/LINGYUN/Abp/Elsa/EntityFrameworkCore/MySql/WorkflowSettingsStartup.cs +++ b/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa.EntityFrameworkCore.MySql/LINGYUN/Abp/Elsa/EntityFrameworkCore/MySql/WorkflowSettingsStartup.cs @@ -10,10 +10,12 @@ public class WorkflowSettingsStartup : WorkflowSettingsStartupBase protected override void Configure(DbContextOptionsBuilder options, string connectionString) { +#pragma warning disable CS0618 options.UseMySql( connectionString, ServerVersion.AutoDetect(connectionString), mysql => mysql.MigrationsHistoryTable("__EFMigrationsHistory_WorkflowSettings") .TranslateParameterizedCollectionsToConstants()); +#pragma warning restore CS0618 } } diff --git a/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa/LINGYUN.Abp.Elsa.csproj b/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa/LINGYUN.Abp.Elsa.csproj index 0db76a511..85f143811 100644 --- a/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa/LINGYUN.Abp.Elsa.csproj +++ b/aspnet-core/modules/elsa/LINGYUN.Abp.Elsa/LINGYUN.Abp.Elsa.csproj @@ -22,6 +22,8 @@ + + diff --git a/aspnet-core/modules/gdpr/LINGYUN.Abp.Gdpr.Application/LINGYUN/Abp/Gdpr/AbpGdprApplicationModule.cs b/aspnet-core/modules/gdpr/LINGYUN.Abp.Gdpr.Application/LINGYUN/Abp/Gdpr/AbpGdprApplicationModule.cs index 72b562a04..07ce49745 100644 --- a/aspnet-core/modules/gdpr/LINGYUN.Abp.Gdpr.Application/LINGYUN/Abp/Gdpr/AbpGdprApplicationModule.cs +++ b/aspnet-core/modules/gdpr/LINGYUN.Abp.Gdpr.Application/LINGYUN/Abp/Gdpr/AbpGdprApplicationModule.cs @@ -1,7 +1,6 @@ using LINGYUN.Abp.Exporter; using Microsoft.Extensions.DependencyInjection; using Volo.Abp.Application; -using Volo.Abp.AutoMapper; using Volo.Abp.Modularity; namespace LINGYUN.Abp.Gdpr; @@ -16,11 +15,6 @@ public class AbpGdprApplicationModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { - context.Services.AddAutoMapperObjectMapper(); - - Configure(options => - { - options.AddMaps(validate: true); - }); + context.Services.AddMapperlyObjectMapper(); } } diff --git a/aspnet-core/modules/gdpr/LINGYUN.Abp.Gdpr.Application/LINGYUN/Abp/Gdpr/GdprApplicationMapperProfile.cs b/aspnet-core/modules/gdpr/LINGYUN.Abp.Gdpr.Application/LINGYUN/Abp/Gdpr/GdprApplicationMapperProfile.cs deleted file mode 100644 index e9b01cb4c..000000000 --- a/aspnet-core/modules/gdpr/LINGYUN.Abp.Gdpr.Application/LINGYUN/Abp/Gdpr/GdprApplicationMapperProfile.cs +++ /dev/null @@ -1,10 +0,0 @@ -using AutoMapper; - -namespace LINGYUN.Abp.Gdpr; -public class GdprApplicationMapperProfile : Profile -{ - public GdprApplicationMapperProfile() - { - CreateMap(); - } -} diff --git a/aspnet-core/modules/gdpr/LINGYUN.Abp.Gdpr.Application/LINGYUN/Abp/Gdpr/GdprApplicationMappers.cs b/aspnet-core/modules/gdpr/LINGYUN.Abp.Gdpr.Application/LINGYUN/Abp/Gdpr/GdprApplicationMappers.cs new file mode 100644 index 000000000..0b9fdf1cc --- /dev/null +++ b/aspnet-core/modules/gdpr/LINGYUN.Abp.Gdpr.Application/LINGYUN/Abp/Gdpr/GdprApplicationMappers.cs @@ -0,0 +1,11 @@ +using Riok.Mapperly.Abstractions; +using Volo.Abp.Mapperly; + +namespace LINGYUN.Abp.Gdpr; + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class GdprRequestToGdprRequestDtoMapper : MapperBase +{ + public override partial GdprRequestDto Map(GdprRequest source); + public override partial void Map(GdprRequest source, GdprRequestDto destination); +} diff --git a/aspnet-core/modules/gdpr/LINGYUN.Abp.Gdpr.Domain/LINGYUN.Abp.Gdpr.Domain.csproj b/aspnet-core/modules/gdpr/LINGYUN.Abp.Gdpr.Domain/LINGYUN.Abp.Gdpr.Domain.csproj index b925936d9..b5cc06334 100644 --- a/aspnet-core/modules/gdpr/LINGYUN.Abp.Gdpr.Domain/LINGYUN.Abp.Gdpr.Domain.csproj +++ b/aspnet-core/modules/gdpr/LINGYUN.Abp.Gdpr.Domain/LINGYUN.Abp.Gdpr.Domain.csproj @@ -15,7 +15,7 @@ - + diff --git a/aspnet-core/modules/gdpr/LINGYUN.Abp.Gdpr.Domain/LINGYUN/Abp/Gdpr/AbpGdprDomainModule.cs b/aspnet-core/modules/gdpr/LINGYUN.Abp.Gdpr.Domain/LINGYUN/Abp/Gdpr/AbpGdprDomainModule.cs index 8773d10ee..537336458 100644 --- a/aspnet-core/modules/gdpr/LINGYUN.Abp.Gdpr.Domain/LINGYUN/Abp/Gdpr/AbpGdprDomainModule.cs +++ b/aspnet-core/modules/gdpr/LINGYUN.Abp.Gdpr.Domain/LINGYUN/Abp/Gdpr/AbpGdprDomainModule.cs @@ -1,12 +1,12 @@ using Microsoft.Extensions.DependencyInjection; -using Volo.Abp.AutoMapper; +using Volo.Abp.Mapperly; using Volo.Abp.Domain; using Volo.Abp.Modularity; namespace LINGYUN.Abp.Gdpr; [DependsOn( - typeof(AbpAutoMapperModule), + typeof(AbpMapperlyModule), typeof(AbpDddDomainModule), typeof(AbpGdprDomainSharedModule) )] @@ -19,11 +19,6 @@ public class AbpGdprDomainModule : AbpModule Configure(configuration.GetSection("Gdpr")); Configure(configuration.GetSection("CookieConsent")); - context.Services.AddAutoMapperObjectMapper(); - - Configure(options => - { - options.AddMaps(validate: true); - }); + context.Services.AddMapperlyObjectMapper(); } } diff --git a/aspnet-core/modules/gdpr/LINGYUN.Abp.Gdpr.Domain/LINGYUN/Abp/Gdpr/GdprDomainMapperProfile.cs b/aspnet-core/modules/gdpr/LINGYUN.Abp.Gdpr.Domain/LINGYUN/Abp/Gdpr/GdprDomainMapperProfile.cs deleted file mode 100644 index 084bef33d..000000000 --- a/aspnet-core/modules/gdpr/LINGYUN.Abp.Gdpr.Domain/LINGYUN/Abp/Gdpr/GdprDomainMapperProfile.cs +++ /dev/null @@ -1,10 +0,0 @@ -using AutoMapper; - -namespace LINGYUN.Abp.Gdpr; -public class GdprDomainMapperProfile : Profile -{ - public GdprDomainMapperProfile() - { - - } -} diff --git a/aspnet-core/modules/gdpr/LINGYUN.Abp.Gdpr.Web/AbpGdprWebModule.cs b/aspnet-core/modules/gdpr/LINGYUN.Abp.Gdpr.Web/AbpGdprWebModule.cs index dad0afe7b..efae4e8b6 100644 --- a/aspnet-core/modules/gdpr/LINGYUN.Abp.Gdpr.Web/AbpGdprWebModule.cs +++ b/aspnet-core/modules/gdpr/LINGYUN.Abp.Gdpr.Web/AbpGdprWebModule.cs @@ -1,6 +1,5 @@ using LINGYUN.Abp.Gdpr.Localization; using LINGYUN.Abp.Gdpr.Web.Pages.Account; -using LINGYUN.Abp.Gdpr.Web.Pages.Account.Components.ProfileManagementGroup.Gdpr; using LINGYUN.Abp.Gdpr.Web.ProfileManagement; using Microsoft.Extensions.DependencyInjection; using Volo.Abp.Account.Web; @@ -8,7 +7,6 @@ using Volo.Abp.Account.Web.Pages.Account; using Volo.Abp.Account.Web.ProfileManagement; using Volo.Abp.AspNetCore.Mvc.Localization; using Volo.Abp.AspNetCore.Mvc.UI.Bundling; -using Volo.Abp.AutoMapper; using Volo.Abp.Http.ProxyScripting.Generators.JQuery; using Volo.Abp.Modularity; using Volo.Abp.UI.Navigation; @@ -48,12 +46,6 @@ public class AbpGdprWebModule : AbpModule ConfigureProfileManagementPage(); - context.Services.AddAutoMapperObjectMapper(); - Configure(options => - { - options.AddMaps(validate: true); - }); - Configure(options => { options.DisableModule(GdprRemoteServiceConsts.ModuleName); diff --git a/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application/LINGYUN/Abp/Identity/AbpIdentityApplicationMappers.cs b/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application/LINGYUN/Abp/Identity/AbpIdentityApplicationMappers.cs new file mode 100644 index 000000000..e0eecab27 --- /dev/null +++ b/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application/LINGYUN/Abp/Identity/AbpIdentityApplicationMappers.cs @@ -0,0 +1,59 @@ +using Riok.Mapperly.Abstractions; +using Volo.Abp.Identity; +using Volo.Abp.Mapperly; + +namespace LINGYUN.Abp.Identity; + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +[MapExtraProperties] +public partial class IdentityClaimTypeToIdentityClaimTypeDtoMapper: MapperBase +{ + public override partial IdentityClaimTypeDto Map(IdentityClaimType source); + public override partial void Map(IdentityClaimType source, IdentityClaimTypeDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class IdentityUserClaimToIdentityClaimDtoMapper : MapperBase +{ + public override partial IdentityClaimDto Map(IdentityUserClaim source); + public override partial void Map(IdentityUserClaim source, IdentityClaimDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class IdentityRoleClaimToIdentityClaimDtoMapper : MapperBase +{ + public override partial IdentityClaimDto Map(IdentityRoleClaim source); + public override partial void Map(IdentityRoleClaim source, IdentityClaimDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +[MapExtraProperties] +public partial class IdentityUserToIdentityUserDtoMapper : MapperBase +{ + public override partial IdentityUserDto Map(IdentityUser source); + public override partial void Map(IdentityUser source, IdentityUserDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +[MapExtraProperties] +public partial class IdentitySessionToIdentitySessionDtoMapper : MapperBase +{ + public override partial IdentitySessionDto Map(IdentitySession source); + public override partial void Map(IdentitySession source, IdentitySessionDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +[MapExtraProperties] +public partial class IdentityRoleToIdentityRoleDtoMapper : MapperBase +{ + public override partial IdentityRoleDto Map(IdentityRole source); + public override partial void Map(IdentityRole source, IdentityRoleDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +[MapExtraProperties] +public partial class OrganizationUnitToOrganizationUnitDtoMapper : MapperBase +{ + public override partial OrganizationUnitDto Map(OrganizationUnit source); + public override partial void Map(OrganizationUnit source, OrganizationUnitDto destination); +} diff --git a/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application/LINGYUN/Abp/Identity/AbpIdentityApplicationModule.cs b/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application/LINGYUN/Abp/Identity/AbpIdentityApplicationModule.cs index cb6485410..441fccbdc 100644 --- a/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application/LINGYUN/Abp/Identity/AbpIdentityApplicationModule.cs +++ b/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application/LINGYUN/Abp/Identity/AbpIdentityApplicationModule.cs @@ -1,5 +1,4 @@ using Microsoft.Extensions.DependencyInjection; -using Volo.Abp.AutoMapper; using Volo.Abp.Modularity; namespace LINGYUN.Abp.Identity; @@ -13,12 +12,7 @@ public class AbpIdentityApplicationModule : AbpModule // private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner(); public override void ConfigureServices(ServiceConfigurationContext context) { - context.Services.AddAutoMapperObjectMapper(); - - Configure(options => - { - options.AddProfile(validate: true); - }); + context.Services.AddMapperlyObjectMapper(); } //public override void PostConfigureServices(ServiceConfigurationContext context) diff --git a/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application/LINGYUN/Abp/Identity/AbpIdentityApplicationModuleAutoMapperProfile.cs b/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application/LINGYUN/Abp/Identity/AbpIdentityApplicationModuleAutoMapperProfile.cs deleted file mode 100644 index 8fc74af91..000000000 --- a/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Application/LINGYUN/Abp/Identity/AbpIdentityApplicationModuleAutoMapperProfile.cs +++ /dev/null @@ -1,26 +0,0 @@ -using AutoMapper; -using Volo.Abp.Identity; - -namespace LINGYUN.Abp.Identity; - -public class AbpIdentityApplicationModuleAutoMapperProfile : Profile -{ - public AbpIdentityApplicationModuleAutoMapperProfile() - { - CreateMap() - .MapExtraProperties(); - CreateMap(); - CreateMap(); - - CreateMap() - .MapExtraProperties(); - - CreateMap(); - - CreateMap() - .MapExtraProperties(); - - CreateMap() - .MapExtraProperties(); - } -} diff --git a/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain/LINGYUN/Abp/Identity/AbpIdentityDomainModule.cs b/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain/LINGYUN/Abp/Identity/AbpIdentityDomainModule.cs index 83f45536f..51143849a 100644 --- a/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain/LINGYUN/Abp/Identity/AbpIdentityDomainModule.cs +++ b/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain/LINGYUN/Abp/Identity/AbpIdentityDomainModule.cs @@ -3,7 +3,6 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; using System.Threading.Tasks; using Volo.Abp; -using Volo.Abp.AutoMapper; using Volo.Abp.BackgroundWorkers; using Volo.Abp.DistributedLocking; using Volo.Abp.Domain.Entities.Events.Distributed; @@ -21,12 +20,7 @@ public class AbpIdentityDomainModule : 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/identity/LINGYUN.Abp.Identity.Domain/LINGYUN/Abp/Identity/IdentityDomainMappers.cs b/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain/LINGYUN/Abp/Identity/IdentityDomainMappers.cs new file mode 100644 index 000000000..df59fd38d --- /dev/null +++ b/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain/LINGYUN/Abp/Identity/IdentityDomainMappers.cs @@ -0,0 +1,12 @@ +using Riok.Mapperly.Abstractions; +using Volo.Abp.Identity; +using Volo.Abp.Mapperly; + +namespace LINGYUN.Abp.Identity; + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class IdentitySessionToIdentitySessionEtoMapper : MapperBase +{ + public override partial IdentitySessionEto Map(IdentitySession source); + public override partial void Map(IdentitySession source, IdentitySessionEto destination); +} diff --git a/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain/LINGYUN/Abp/Identity/IdentityDomainMappingProfile.cs b/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain/LINGYUN/Abp/Identity/IdentityDomainMappingProfile.cs deleted file mode 100644 index 7a8e62e02..000000000 --- a/aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain/LINGYUN/Abp/Identity/IdentityDomainMappingProfile.cs +++ /dev/null @@ -1,12 +0,0 @@ -using AutoMapper; -using Volo.Abp.Identity; - -namespace LINGYUN.Abp.Identity; - -public class IdentityDomainMappingProfile : Profile -{ - public IdentityDomainMappingProfile() - { - CreateMap(); - } -} diff --git a/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/ApiScopes/Dto/ApiScopePropertyDto.cs b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/ApiScopes/Dto/ApiScopePropertyDto.cs index d30efc97a..ead5854f8 100644 --- a/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/ApiScopes/Dto/ApiScopePropertyDto.cs +++ b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/ApiScopes/Dto/ApiScopePropertyDto.cs @@ -1,9 +1,8 @@ -using System; -using Volo.Abp.Application.Dtos; +using Volo.Abp.Application.Dtos; namespace LINGYUN.Abp.IdentityServer.ApiScopes; -public class ApiScopePropertyDto : EntityDto +public class ApiScopePropertyDto : EntityDto { public string Key { get; set; } diff --git a/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application/LINGYUN/Abp/IdentityServer/AbpIdentityServerApplicationMappers.cs b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application/LINGYUN/Abp/IdentityServer/AbpIdentityServerApplicationMappers.cs new file mode 100644 index 000000000..b71903766 --- /dev/null +++ b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application/LINGYUN/Abp/IdentityServer/AbpIdentityServerApplicationMappers.cs @@ -0,0 +1,173 @@ +using LINGYUN.Abp.IdentityServer.ApiResources; +using LINGYUN.Abp.IdentityServer.ApiScopes; +using LINGYUN.Abp.IdentityServer.Clients; +using LINGYUN.Abp.IdentityServer.Grants; +using LINGYUN.Abp.IdentityServer.IdentityResources; +using Riok.Mapperly.Abstractions; +using Volo.Abp.IdentityServer.ApiResources; +using Volo.Abp.IdentityServer.ApiScopes; +using Volo.Abp.IdentityServer.Clients; +using Volo.Abp.IdentityServer.Grants; +using Volo.Abp.IdentityServer.IdentityResources; +using Volo.Abp.Mapperly; + +namespace LINGYUN.Abp.IdentityServer; + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class ClientSecretToClientSecretDtoMapper : MapperBase +{ + public override partial ClientSecretDto Map(ClientSecret source); + public override partial void Map(ClientSecret source, ClientSecretDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class ClientScopeToClientScopeDtoMapper : MapperBase +{ + public override partial ClientScopeDto Map(ClientScope source); + public override partial void Map(ClientScope source, ClientScopeDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class ClientGrantTypeToClientGrantTypeDtoMapper : MapperBase +{ + public override partial ClientGrantTypeDto Map(ClientGrantType source); + public override partial void Map(ClientGrantType source, ClientGrantTypeDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class ClientCorsOriginToClientCorsOriginDtoMapper : MapperBase +{ + public override partial ClientCorsOriginDto Map(ClientCorsOrigin source); + public override partial void Map(ClientCorsOrigin source, ClientCorsOriginDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class ClientRedirectUriToClientRedirectUriDtoMapper : MapperBase +{ + public override partial ClientRedirectUriDto Map(ClientRedirectUri source); + public override partial void Map(ClientRedirectUri source, ClientRedirectUriDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class ClientPostLogoutRedirectUriToClientPostLogoutRedirectUriDtoMapper : MapperBase +{ + public override partial ClientPostLogoutRedirectUriDto Map(ClientPostLogoutRedirectUri source); + public override partial void Map(ClientPostLogoutRedirectUri source, ClientPostLogoutRedirectUriDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class ClientIdPRestrictionToClientIdPRestrictionDtoMapper : MapperBase +{ + public override partial ClientIdPRestrictionDto Map(ClientIdPRestriction source); + public override partial void Map(ClientIdPRestriction source, ClientIdPRestrictionDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class ClientClaimToClientClaimDtoMapper : MapperBase +{ + public override partial ClientClaimDto Map(ClientClaim source); + public override partial void Map(ClientClaim source, ClientClaimDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class ClientPropertyToClientPropertyDtoMapper : MapperBase +{ + public override partial ClientPropertyDto Map(ClientProperty source); + public override partial void Map(ClientProperty source, ClientPropertyDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +[MapExtraProperties] +public partial class ClientToClientDtoMapper : MapperBase +{ + public override partial ClientDto Map(Client source); + public override partial void Map(Client source, ClientDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class ApiScopeClaimToApiScopeClaimDtoMapper : MapperBase +{ + public override partial ApiScopeClaimDto Map(ApiScopeClaim source); + public override partial void Map(ApiScopeClaim source, ApiScopeClaimDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class ApiScopePropertyToApiScopePropertyDtoMapper : MapperBase +{ + public override partial ApiScopePropertyDto Map(ApiScopeProperty source); + public override partial void Map(ApiScopeProperty source, ApiScopePropertyDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +[MapExtraProperties] +public partial class ApiScopeToApiScopeDtoMapper : MapperBase +{ + public override partial ApiScopeDto Map(ApiScope source); + public override partial void Map(ApiScope source, ApiScopeDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class ApiResourcePropertyToApiResourcePropertyDtoMapper : MapperBase +{ + public override partial ApiResourcePropertyDto Map(ApiResourceProperty source); + public override partial void Map(ApiResourceProperty source, ApiResourcePropertyDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class ApiResourceSecretToApiResourceSecretDtoMapper : MapperBase +{ + public override partial ApiResourceSecretDto Map(ApiResourceSecret source); + public override partial void Map(ApiResourceSecret source, ApiResourceSecretDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class ApiResourceScopeToApiResourceScopeDtoMapper : MapperBase +{ + public override partial ApiResourceScopeDto Map(ApiResourceScope source); + public override partial void Map(ApiResourceScope source, ApiResourceScopeDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class ApiResourceClaimToApiResourceClaimDtoMapper : MapperBase +{ + public override partial ApiResourceClaimDto Map(ApiResourceClaim source); + public override partial void Map(ApiResourceClaim source, ApiResourceClaimDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +[MapExtraProperties] +public partial class ApiResourceToApiResourceDtoMapper : MapperBase +{ + public override partial ApiResourceDto Map(ApiResource source); + public override partial void Map(ApiResource source, ApiResourceDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class IdentityResourceClaimToIdentityResourceClaimDtoMapper : MapperBase +{ + public override partial IdentityResourceClaimDto Map(IdentityResourceClaim source); + public override partial void Map(IdentityResourceClaim source, IdentityResourceClaimDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class IdentityResourcePropertyToIdentityResourcePropertyDtoMapper : MapperBase +{ + public override partial IdentityResourcePropertyDto Map(IdentityResourceProperty source); + public override partial void Map(IdentityResourceProperty source, IdentityResourcePropertyDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +[MapExtraProperties] +public partial class IdentityResourceToIdentityResourceDtoMapper : MapperBase +{ + public override partial IdentityResourceDto Map(IdentityResource source); + public override partial void Map(IdentityResource source, IdentityResourceDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +[MapExtraProperties] +public partial class PersistedGrantToPersistedGrantDtoMapper : MapperBase +{ + public override partial PersistedGrantDto Map(PersistedGrant source); + public override partial void Map(PersistedGrant source, PersistedGrantDto destination); +} diff --git a/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application/LINGYUN/Abp/IdentityServer/AbpIdentityServerApplicationModule.cs b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application/LINGYUN/Abp/IdentityServer/AbpIdentityServerApplicationModule.cs index 7cf85ccfe..8c49287f0 100644 --- a/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application/LINGYUN/Abp/IdentityServer/AbpIdentityServerApplicationModule.cs +++ b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application/LINGYUN/Abp/IdentityServer/AbpIdentityServerApplicationModule.cs @@ -1,5 +1,5 @@ -using Volo.Abp.Application; -using Volo.Abp.AutoMapper; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.Application; using Volo.Abp.Modularity; namespace LINGYUN.Abp.IdentityServer; @@ -7,19 +7,12 @@ namespace LINGYUN.Abp.IdentityServer; [DependsOn( typeof(AbpIdentityServerApplicationContractsModule), typeof(AbpIdentityServerDomainModule), - typeof(AbpDddApplicationModule), - typeof(AbpAutoMapperModule) + typeof(AbpDddApplicationModule) )] public class AbpIdentityServerApplicationModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { - Configure(options => - { - options.Configurators.Add(ctx => - { - ctx.MapperConfiguration.AddProfile(); - }); - }); + context.Services.AddMapperlyObjectMapper(); } } diff --git a/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application/LINGYUN/Abp/IdentityServer/AbpIdentityServerAutoMapperProfile.cs b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application/LINGYUN/Abp/IdentityServer/AbpIdentityServerAutoMapperProfile.cs deleted file mode 100644 index 7839e78d7..000000000 --- a/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application/LINGYUN/Abp/IdentityServer/AbpIdentityServerAutoMapperProfile.cs +++ /dev/null @@ -1,56 +0,0 @@ -using AutoMapper; -using LINGYUN.Abp.IdentityServer.ApiResources; -using LINGYUN.Abp.IdentityServer.ApiScopes; -using LINGYUN.Abp.IdentityServer.Clients; -using LINGYUN.Abp.IdentityServer.Grants; -using LINGYUN.Abp.IdentityServer.IdentityResources; -using Volo.Abp.IdentityServer.ApiResources; -using Volo.Abp.IdentityServer.ApiScopes; -using Volo.Abp.IdentityServer.Clients; -using Volo.Abp.IdentityServer.Grants; -using Volo.Abp.IdentityServer.IdentityResources; - -namespace LINGYUN.Abp.IdentityServer; - -public class AbpIdentityServerAutoMapperProfile : Profile -{ - public AbpIdentityServerAutoMapperProfile() - { - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - //.ForMember(dto => dto.AllowedCorsOrigins, map => map.MapFrom(client => client.AllowedCorsOrigins.Select(origin => origin.Origin).ToList())) - //.ForMember(dto => dto.AllowedGrantTypes, map => map.MapFrom(client => client.AllowedGrantTypes.Select(grantType => grantType.GrantType).ToList())) - //.ForMember(dto => dto.AllowedScopes, map => map.MapFrom(client => client.AllowedScopes.Select(scope => scope.Scope).ToList())) - //.ForMember(dto => dto.IdentityProviderRestrictions, map => map.MapFrom(client => client.IdentityProviderRestrictions.Select(provider => provider.Provider).ToList())) - //.ForMember(dto => dto.PostLogoutRedirectUris, map => map.MapFrom(client => client.PostLogoutRedirectUris.Select(uri => uri.PostLogoutRedirectUri).ToList())) - //.ForMember(dto => dto.RedirectUris, map => map.MapFrom(client => client.RedirectUris.Select(uri => uri.RedirectUri).ToList())); - - // CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap() - .MapExtraProperties(); - - CreateMap(); - CreateMap(); - CreateMap() - .MapExtraProperties(); - - CreateMap() - .MapExtraProperties(); - } -} diff --git a/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Domain/LINGYUN.Abp.IdentityServer.Domain.csproj b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Domain/LINGYUN.Abp.IdentityServer.Domain.csproj index 00fb31b93..3dbaac294 100644 --- a/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Domain/LINGYUN.Abp.IdentityServer.Domain.csproj +++ b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Domain/LINGYUN.Abp.IdentityServer.Domain.csproj @@ -14,6 +14,7 @@ + diff --git a/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.LinkUser/LINGYUN.Abp.IdentityServer.LinkUser.csproj b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.LinkUser/LINGYUN.Abp.IdentityServer.LinkUser.csproj index ffb7f6fbd..7d3ad5a5c 100644 --- a/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.LinkUser/LINGYUN.Abp.IdentityServer.LinkUser.csproj +++ b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.LinkUser/LINGYUN.Abp.IdentityServer.LinkUser.csproj @@ -22,6 +22,7 @@ + diff --git a/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.SmsValidator/LINGYUN.Abp.IdentityServer.SmsValidator.csproj b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.SmsValidator/LINGYUN.Abp.IdentityServer.SmsValidator.csproj index 2d3de7e4b..2ba20a9c8 100644 --- a/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.SmsValidator/LINGYUN.Abp.IdentityServer.SmsValidator.csproj +++ b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.SmsValidator/LINGYUN.Abp.IdentityServer.SmsValidator.csproj @@ -24,6 +24,7 @@ + diff --git a/aspnet-core/modules/localization-management/LINGYUN.Abp.LocalizationManagement.Application/LINGYUN/Abp/LocalizationManagement/AbpLocalizationManagementApplicationModule.cs b/aspnet-core/modules/localization-management/LINGYUN.Abp.LocalizationManagement.Application/LINGYUN/Abp/LocalizationManagement/AbpLocalizationManagementApplicationModule.cs index b9e9c340f..c1985a3a2 100644 --- a/aspnet-core/modules/localization-management/LINGYUN.Abp.LocalizationManagement.Application/LINGYUN/Abp/LocalizationManagement/AbpLocalizationManagementApplicationModule.cs +++ b/aspnet-core/modules/localization-management/LINGYUN.Abp.LocalizationManagement.Application/LINGYUN/Abp/LocalizationManagement/AbpLocalizationManagementApplicationModule.cs @@ -1,7 +1,6 @@ -using Volo.Abp.Application; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.Application; using Volo.Abp.Modularity; -using Microsoft.Extensions.DependencyInjection; -using Volo.Abp.AutoMapper; namespace LINGYUN.Abp.LocalizationManagement; @@ -13,11 +12,6 @@ public class AbpLocalizationManagementApplicationModule : 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/localization-management/LINGYUN.Abp.LocalizationManagement.Application/LINGYUN/Abp/LocalizationManagement/LocalizationManagementApplicationMapperProfile.cs b/aspnet-core/modules/localization-management/LINGYUN.Abp.LocalizationManagement.Application/LINGYUN/Abp/LocalizationManagement/LocalizationManagementApplicationMapperProfile.cs deleted file mode 100644 index be4a77452..000000000 --- a/aspnet-core/modules/localization-management/LINGYUN.Abp.LocalizationManagement.Application/LINGYUN/Abp/LocalizationManagement/LocalizationManagementApplicationMapperProfile.cs +++ /dev/null @@ -1,12 +0,0 @@ -using AutoMapper; - -namespace LINGYUN.Abp.LocalizationManagement; - -public class LocalizationManagementApplicationMapperProfile : Profile -{ - public LocalizationManagementApplicationMapperProfile() - { - CreateMap(); - CreateMap(); - } -} diff --git a/aspnet-core/modules/localization-management/LINGYUN.Abp.LocalizationManagement.Application/LINGYUN/Abp/LocalizationManagement/LocalizationManagementApplicationMappers.cs b/aspnet-core/modules/localization-management/LINGYUN.Abp.LocalizationManagement.Application/LINGYUN/Abp/LocalizationManagement/LocalizationManagementApplicationMappers.cs new file mode 100644 index 000000000..e959b833e --- /dev/null +++ b/aspnet-core/modules/localization-management/LINGYUN.Abp.LocalizationManagement.Application/LINGYUN/Abp/LocalizationManagement/LocalizationManagementApplicationMappers.cs @@ -0,0 +1,18 @@ +using Riok.Mapperly.Abstractions; +using Volo.Abp.Mapperly; + +namespace LINGYUN.Abp.LocalizationManagement; + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class LanguageToLanguageDtoMapper : MapperBase +{ + public override partial LanguageDto Map(Language source); + public override partial void Map(Language source, LanguageDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class ResourceToResourceDtoMapper : MapperBase +{ + public override partial ResourceDto Map(Resource source); + public override partial void Map(Resource source, ResourceDto destination); +} diff --git a/aspnet-core/modules/localization-management/LINGYUN.Abp.LocalizationManagement.Domain/LINGYUN.Abp.LocalizationManagement.Domain.csproj b/aspnet-core/modules/localization-management/LINGYUN.Abp.LocalizationManagement.Domain/LINGYUN.Abp.LocalizationManagement.Domain.csproj index 8874f56db..85d293454 100644 --- a/aspnet-core/modules/localization-management/LINGYUN.Abp.LocalizationManagement.Domain/LINGYUN.Abp.LocalizationManagement.Domain.csproj +++ b/aspnet-core/modules/localization-management/LINGYUN.Abp.LocalizationManagement.Domain/LINGYUN.Abp.LocalizationManagement.Domain.csproj @@ -15,7 +15,7 @@ - + diff --git a/aspnet-core/modules/localization-management/LINGYUN.Abp.LocalizationManagement.Domain/LINGYUN/Abp/LocalizationManagement/AbpLocalizationManagementDomainModule.cs b/aspnet-core/modules/localization-management/LINGYUN.Abp.LocalizationManagement.Domain/LINGYUN/Abp/LocalizationManagement/AbpLocalizationManagementDomainModule.cs index cd72e0047..ba96b7a14 100644 --- a/aspnet-core/modules/localization-management/LINGYUN.Abp.LocalizationManagement.Domain/LINGYUN/Abp/LocalizationManagement/AbpLocalizationManagementDomainModule.cs +++ b/aspnet-core/modules/localization-management/LINGYUN.Abp.LocalizationManagement.Domain/LINGYUN/Abp/LocalizationManagement/AbpLocalizationManagementDomainModule.cs @@ -7,19 +7,19 @@ using System; using System.Threading; using System.Threading.Tasks; using Volo.Abp; -using Volo.Abp.AutoMapper; using Volo.Abp.Data; using Volo.Abp.DependencyInjection; using Volo.Abp.Domain; using Volo.Abp.Domain.Entities.Events.Distributed; using Volo.Abp.Localization; +using Volo.Abp.Mapperly; using Volo.Abp.Modularity; using Volo.Abp.Threading; namespace LINGYUN.Abp.LocalizationManagement; [DependsOn( - typeof(AbpAutoMapperModule), + typeof(AbpMapperlyModule), typeof(AbpDddDomainModule), typeof(AbpLocalizationManagementDomainSharedModule))] public class AbpLocalizationManagementDomainModule : AbpModule @@ -27,12 +27,7 @@ public class AbpLocalizationManagementDomainModule : AbpModule private readonly CancellationTokenSource cancellationTokenSource = new(); 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/localization-management/LINGYUN.Abp.LocalizationManagement.Domain/LINGYUN/Abp/LocalizationManagement/LocalizationManagementDomainMapperProfile.cs b/aspnet-core/modules/localization-management/LINGYUN.Abp.LocalizationManagement.Domain/LINGYUN/Abp/LocalizationManagement/LocalizationManagementDomainMapperProfile.cs deleted file mode 100644 index 20ba4e535..000000000 --- a/aspnet-core/modules/localization-management/LINGYUN.Abp.LocalizationManagement.Domain/LINGYUN/Abp/LocalizationManagement/LocalizationManagementDomainMapperProfile.cs +++ /dev/null @@ -1,13 +0,0 @@ -using AutoMapper; - -namespace LINGYUN.Abp.LocalizationManagement; - -public class LocalizationManagementDomainMapperProfile : Profile -{ - public LocalizationManagementDomainMapperProfile() - { - CreateMap(); - CreateMap(); - CreateMap(); - } -} diff --git a/aspnet-core/modules/localization-management/LINGYUN.Abp.LocalizationManagement.Domain/LINGYUN/Abp/LocalizationManagement/LocalizationManagementDomainMappers.cs b/aspnet-core/modules/localization-management/LINGYUN.Abp.LocalizationManagement.Domain/LINGYUN/Abp/LocalizationManagement/LocalizationManagementDomainMappers.cs new file mode 100644 index 000000000..7f0bf9096 --- /dev/null +++ b/aspnet-core/modules/localization-management/LINGYUN.Abp.LocalizationManagement.Domain/LINGYUN/Abp/LocalizationManagement/LocalizationManagementDomainMappers.cs @@ -0,0 +1,25 @@ +using Riok.Mapperly.Abstractions; +using Volo.Abp.Mapperly; + +namespace LINGYUN.Abp.LocalizationManagement; + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class TextToTextEtoMapper : MapperBase +{ + public override partial TextEto Map(Text source); + public override partial void Map(Text source, TextEto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class ResourceToResourceEtoMapper : MapperBase +{ + public override partial ResourceEto Map(Resource source); + public override partial void Map(Resource source, ResourceEto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class LanguageToLanguageEtoMapper : MapperBase +{ + public override partial LanguageEto Map(Language source); + public override partial void Map(Language source, LanguageEto destination); +} diff --git a/aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.AspNetCore.Session/LINGYUN/Abp/OpenIddict/AspNetCore/Session/RevocationIdentitySession.cs b/aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.AspNetCore.Session/LINGYUN/Abp/OpenIddict/AspNetCore/Session/RevocationIdentitySession.cs index 41cbb9c89..a3428ede1 100644 --- a/aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.AspNetCore.Session/LINGYUN/Abp/OpenIddict/AspNetCore/Session/RevocationIdentitySession.cs +++ b/aspnet-core/modules/openIddict/LINGYUN.Abp.OpenIddict.AspNetCore.Session/LINGYUN/Abp/OpenIddict/AspNetCore/Session/RevocationIdentitySession.cs @@ -32,8 +32,8 @@ public class RevocationIdentitySession : IOpenIddictServerHandler 401 // Errors.ExpiredToken ---> 400 diff --git a/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.Application/LINGYUN.Abp.OssManagement.Application.csproj b/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.Application/LINGYUN.Abp.OssManagement.Application.csproj index cd2ef7d70..1852601e8 100644 --- a/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.Application/LINGYUN.Abp.OssManagement.Application.csproj +++ b/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.Application/LINGYUN.Abp.OssManagement.Application.csproj @@ -14,7 +14,7 @@ - + diff --git a/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.Application/LINGYUN/Abp/OssManagement/AbpOssManagementApplicationModule.cs b/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.Application/LINGYUN/Abp/OssManagement/AbpOssManagementApplicationModule.cs index e02b4fbd5..a2ca04c3d 100644 --- a/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.Application/LINGYUN/Abp/OssManagement/AbpOssManagementApplicationModule.cs +++ b/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.Application/LINGYUN/Abp/OssManagement/AbpOssManagementApplicationModule.cs @@ -1,7 +1,7 @@ using Microsoft.Extensions.DependencyInjection; using Volo.Abp.Application; -using Volo.Abp.AutoMapper; using Volo.Abp.Caching; +using Volo.Abp.Mapperly; using Volo.Abp.Modularity; namespace LINGYUN.Abp.OssManagement; @@ -10,17 +10,12 @@ namespace LINGYUN.Abp.OssManagement; typeof(AbpOssManagementDomainModule), typeof(AbpOssManagementApplicationContractsModule), typeof(AbpCachingModule), - typeof(AbpAutoMapperModule), + typeof(AbpMapperlyModule), typeof(AbpDddApplicationModule))] public class AbpOssManagementApplicationModule : 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/oss-management/LINGYUN.Abp.OssManagement.Application/LINGYUN/Abp/OssManagement/OssManagementApplicationAutoMapperProfile.cs b/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.Application/LINGYUN/Abp/OssManagement/OssManagementApplicationAutoMapperProfile.cs deleted file mode 100644 index 8fc0cc6e2..000000000 --- a/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.Application/LINGYUN/Abp/OssManagement/OssManagementApplicationAutoMapperProfile.cs +++ /dev/null @@ -1,18 +0,0 @@ -using AutoMapper; - -namespace LINGYUN.Abp.OssManagement; - -public class OssManagementApplicationAutoMapperProfile : Profile -{ - public OssManagementApplicationAutoMapperProfile() - { - CreateMap(); - CreateMap() - .ForMember(dto => dto.Path, map => map.MapFrom(src => src.Prefix)); - - CreateMap(); - CreateMap(); - - CreateMap(); - } -} diff --git a/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.Application/LINGYUN/Abp/OssManagement/OssManagementApplicationMappers.cs b/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.Application/LINGYUN/Abp/OssManagement/OssManagementApplicationMappers.cs new file mode 100644 index 000000000..9ef13678e --- /dev/null +++ b/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.Application/LINGYUN/Abp/OssManagement/OssManagementApplicationMappers.cs @@ -0,0 +1,49 @@ +using Riok.Mapperly.Abstractions; +using Volo.Abp.Mapperly; + +namespace LINGYUN.Abp.OssManagement; + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class OssContainerToOssContainerDtoMapper : MapperBase +{ + public override partial OssContainerDto Map(OssContainer source); + public override partial void Map(OssContainer source, OssContainerDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class OssObjectToOssObjectDtoMapper : MapperBase +{ + [MapperIgnoreTarget(nameof(OssObjectDto.Path))] + [MapperIgnoreSource(nameof(OssObject.Prefix))] + public override partial OssObjectDto Map(OssObject source); + + [MapperIgnoreTarget(nameof(OssObjectDto.Path))] + [MapperIgnoreSource(nameof(OssObject.Prefix))] + public override partial void Map(OssObject source, OssObjectDto destination); + + public override void AfterMap(OssObject source, OssObjectDto destination) + { + destination.Path = source.Prefix; + } +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class GetOssContainersResponseToOssContainersResultDtoMapper : MapperBase +{ + public override partial OssContainersResultDto Map(GetOssContainersResponse source); + public override partial void Map(GetOssContainersResponse source, OssContainersResultDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class GetOssObjectsResponseToOssObjectsResultDtoMapper : MapperBase +{ + public override partial OssObjectsResultDto Map(GetOssObjectsResponse source); + public override partial void Map(GetOssObjectsResponse source, OssObjectsResultDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class FileShareCacheItemToMyFileShareDtoMapper : MapperBase +{ + public override partial MyFileShareDto Map(FileShareCacheItem source); + public override partial void Map(FileShareCacheItem source, MyFileShareDto destination); +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/PlatformApplicationMappers.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/PlatformApplicationMappers.cs new file mode 100644 index 000000000..109092fb7 --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/PlatformApplicationMappers.cs @@ -0,0 +1,125 @@ +using LINGYUN.Platform.Datas; +using LINGYUN.Platform.Feedbacks; +using LINGYUN.Platform.Layouts; +using LINGYUN.Platform.Menus; +using LINGYUN.Platform.Messages; +using LINGYUN.Platform.Packages; +using LINGYUN.Platform.Portal; +using Riok.Mapperly.Abstractions; +using Volo.Abp.Mapperly; + +namespace LINGYUN.Platform; + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class PackageBlobTPackageBlobDtoMapper : MapperBase +{ + public override partial PackageBlobDto Map(PackageBlob source); + public override partial void Map(PackageBlob source, PackageBlobDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class PackageTPackageDtoMapper : MapperBase +{ + public override partial PackageDto Map(Package source); + public override partial void Map(Package source, PackageDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class DataItemTDataItemDtoMapper : MapperBase +{ + public override partial DataItemDto Map(DataItem source); + public override partial void Map(DataItem source, DataItemDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class DataTDataDtoMapper : MapperBase +{ + public override partial DataDto Map(Data source); + public override partial void Map(Data source, DataDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class MenuTMenuDtoMapper : MapperBase +{ + [MapperIgnoreTarget(nameof(MenuDto.Startup))] + [MapProperty(nameof(Menu.ExtraProperties), nameof(MenuDto.Meta))] + public override partial MenuDto Map(Menu source); + + [MapperIgnoreTarget(nameof(MenuDto.Startup))] + [MapProperty(nameof(Menu.ExtraProperties), nameof(MenuDto.Meta))] + public override partial void Map(Menu source, MenuDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class LayoutTLayoutDtoMapper : MapperBase +{ + [MapProperty(nameof(Layout.ExtraProperties), nameof(LayoutDto.Meta))] + public override partial LayoutDto Map(Layout source); + + [MapProperty(nameof(Layout.ExtraProperties), nameof(LayoutDto.Meta))] + public override partial void Map(Layout source, LayoutDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class UserFavoriteMenuTUserFavoriteMenuDtoMapper : MapperBase +{ + public override partial UserFavoriteMenuDto Map(UserFavoriteMenu source); + public override partial void Map(UserFavoriteMenu source, UserFavoriteMenuDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class FeedbackTFeedbackDtoMapper : MapperBase +{ + public override partial FeedbackDto Map(Feedback source); + public override partial void Map(Feedback source, FeedbackDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class FeedbackCommentTFeedbackCommentDtoMapper : MapperBase +{ + public override partial FeedbackCommentDto Map(FeedbackComment source); + public override partial void Map(FeedbackComment source, FeedbackCommentDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class FeedbackAttachmentTFeedbackAttachmentDtoMapper : MapperBase +{ + public override partial FeedbackAttachmentDto Map(FeedbackAttachment source); + public override partial void Map(FeedbackAttachment source, FeedbackAttachmentDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class EmailMessageAttachmentTEmailMessageAttachmentDtoMapper : MapperBase +{ + public override partial EmailMessageAttachmentDto Map(EmailMessageAttachment source); + public override partial void Map(EmailMessageAttachment source, EmailMessageAttachmentDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class EmailMessageHeaderTEmailMessageHeaderDtoMapper : MapperBase +{ + public override partial EmailMessageHeaderDto Map(EmailMessageHeader source); + public override partial void Map(EmailMessageHeader source, EmailMessageHeaderDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class EmailMessageTEmailMessageDtoMapper : MapperBase +{ + public override partial EmailMessageDto Map(EmailMessage source); + public override partial void Map(EmailMessage source, EmailMessageDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class SmsMessageTSmsMessageDtoMapper : MapperBase +{ + public override partial SmsMessageDto Map(SmsMessage source); + public override partial void Map(SmsMessage source, SmsMessageDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class EnterpriseTEnterpriseDtoMapper : MapperBase +{ + public override partial EnterpriseDto Map(Enterprise source); + public override partial void Map(Enterprise source, EnterpriseDto destination); +} + diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/PlatformApplicationMappingProfile.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/PlatformApplicationMappingProfile.cs deleted file mode 100644 index 6c18a4a22..000000000 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/PlatformApplicationMappingProfile.cs +++ /dev/null @@ -1,39 +0,0 @@ -using AutoMapper; -using LINGYUN.Platform.Datas; -using LINGYUN.Platform.Feedbacks; -using LINGYUN.Platform.Layouts; -using LINGYUN.Platform.Menus; -using LINGYUN.Platform.Messages; -using LINGYUN.Platform.Packages; -using LINGYUN.Platform.Portal; - -namespace LINGYUN.Platform; - -public class PlatformApplicationMappingProfile : Profile -{ - public PlatformApplicationMappingProfile() - { - CreateMap(); - CreateMap(); - - CreateMap(); - CreateMap(); - CreateMap() - .ForMember(dto => dto.Meta, map => map.MapFrom(src => src.ExtraProperties)) - .ForMember(dto => dto.Startup, map => map.Ignore()); - CreateMap() - .ForMember(dto => dto.Meta, map => map.MapFrom(src => src.ExtraProperties)); - CreateMap(); - - CreateMap(); - CreateMap(); - CreateMap(); - - CreateMap(); - CreateMap(); - CreateMap(); - CreateMap(); - - CreateMap(); - } -} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/PlatformApplicationModule.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/PlatformApplicationModule.cs index 2bd462842..2ae5378b8 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/PlatformApplicationModule.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/PlatformApplicationModule.cs @@ -1,6 +1,5 @@ using Microsoft.Extensions.DependencyInjection; using Volo.Abp.Application; -using Volo.Abp.AutoMapper; using Volo.Abp.Modularity; namespace LINGYUN.Platform; @@ -13,11 +12,6 @@ public class PlatformApplicationModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { - context.Services.AddAutoMapperObjectMapper(); - - Configure(options => - { - options.AddMaps(validate: true); - }); + context.Services.AddMapperlyObjectMapper(); } } diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN.Platform.Domain.csproj b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN.Platform.Domain.csproj index 35ab47da8..4db506676 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN.Platform.Domain.csproj +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN.Platform.Domain.csproj @@ -15,7 +15,7 @@ - + diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDomainMappers.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDomainMappers.cs new file mode 100644 index 000000000..ed77ec80b --- /dev/null +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDomainMappers.cs @@ -0,0 +1,57 @@ +using LINGYUN.Platform.Layouts; +using LINGYUN.Platform.Menus; +using LINGYUN.Platform.Messages; +using LINGYUN.Platform.Packages; +using Riok.Mapperly.Abstractions; +using Volo.Abp.Mapperly; + +namespace LINGYUN.Platform; + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class LayoutToLayoutEtoMapper : MapperBase +{ + public override partial LayoutEto Map(Layout source); + public override partial void Map(Layout source, LayoutEto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class MenuToMenuEtoMapper : MapperBase +{ + public override partial MenuEto Map(Menu source); + public override partial void Map(Menu source, MenuEto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class UserMenuToUserMenuEtoMapper : MapperBase +{ + public override partial UserMenuEto Map(UserMenu source); + public override partial void Map(UserMenu source, UserMenuEto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class RoleMenuToRoleMenuEtoMapper : MapperBase +{ + public override partial RoleMenuEto Map(RoleMenu source); + public override partial void Map(RoleMenu source, RoleMenuEto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class PackageToPackageEtoMapper : MapperBase +{ + public override partial PackageEto Map(Package source); + public override partial void Map(Package source, PackageEto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class EmailMessageToEmailMessageEtoMapper : MapperBase +{ + public override partial EmailMessageEto Map(EmailMessage source); + public override partial void Map(EmailMessage source, EmailMessageEto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class SmsMessageToSmsMessageEtoMapper : MapperBase +{ + public override partial SmsMessageEto Map(SmsMessage source); + public override partial void Map(SmsMessage source, SmsMessageEto destination); +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDomainMappingProfile.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDomainMappingProfile.cs deleted file mode 100644 index 8107baaf2..000000000 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDomainMappingProfile.cs +++ /dev/null @@ -1,24 +0,0 @@ -using AutoMapper; -using LINGYUN.Platform.Layouts; -using LINGYUN.Platform.Menus; -using LINGYUN.Platform.Messages; -using LINGYUN.Platform.Packages; - -namespace LINGYUN.Platform; - -public class PlatformDomainMappingProfile : Profile -{ - public PlatformDomainMappingProfile() - { - CreateMap(); - - CreateMap(); - CreateMap(); - CreateMap(); - - CreateMap(); - - CreateMap(); - CreateMap(); - } -} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDomainModule.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDomainModule.cs index 078d34579..ab68197f0 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDomainModule.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDomainModule.cs @@ -6,11 +6,11 @@ using LINGYUN.Platform.ObjectExtending; using LINGYUN.Platform.Packages; using LINGYUN.Platform.Routes; using Microsoft.Extensions.DependencyInjection; -using Volo.Abp.AutoMapper; using Volo.Abp.BlobStoring; using Volo.Abp.Domain.Entities.Events.Distributed; using Volo.Abp.Emailing; using Volo.Abp.EventBus; +using Volo.Abp.Mapperly; using Volo.Abp.Modularity; using Volo.Abp.ObjectExtending.Modularity; using Volo.Abp.Sms; @@ -22,24 +22,20 @@ namespace LINGYUN.Platform; typeof(AbpSmsModule), typeof(AbpEmailingModule), typeof(AbpEventBusModule), - typeof(AbpBlobStoringModule), + typeof(AbpEventBusModule), + typeof(AbpMapperlyModule), typeof(PlatformDomainSharedModule))] public class PlatformDomainModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { - context.Services.AddAutoMapperObjectMapper(); + context.Services.AddMapperlyObjectMapper(); Configure(options => { options.SetDefaultMapping(); }); - Configure(options => - { - options.AddProfile(validate: true); - }); - Configure(options => { options.Containers.Configure(containerConfiguration => diff --git a/aspnet-core/modules/project/LINGYUN.Abp.ProjectManagement.EntityFrameworkCore/FodyWeavers.xml b/aspnet-core/modules/project/LINGYUN.Abp.ProjectManagement.EntityFrameworkCore/FodyWeavers.xml new file mode 100644 index 000000000..00e1d9a1c --- /dev/null +++ b/aspnet-core/modules/project/LINGYUN.Abp.ProjectManagement.EntityFrameworkCore/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/aspnet-core/modules/project/LINGYUN.Abp.ProjectManagement.EntityFrameworkCore/FodyWeavers.xsd b/aspnet-core/modules/project/LINGYUN.Abp.ProjectManagement.EntityFrameworkCore/FodyWeavers.xsd new file mode 100644 index 000000000..3f3946e28 --- /dev/null +++ b/aspnet-core/modules/project/LINGYUN.Abp.ProjectManagement.EntityFrameworkCore/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/AbpMessageServiceApplicationAutoMapperProfile.cs b/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/AbpMessageServiceApplicationAutoMapperProfile.cs deleted file mode 100644 index 4d9772091..000000000 --- a/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/AbpMessageServiceApplicationAutoMapperProfile.cs +++ /dev/null @@ -1,10 +0,0 @@ -using AutoMapper; - -namespace LINGYUN.Abp.MessageService; - -public class AbpMessageServiceApplicationAutoMapperProfile : Profile -{ - public AbpMessageServiceApplicationAutoMapperProfile() - { - } -} diff --git a/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/AbpMessageServiceApplicationModule.cs b/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/AbpMessageServiceApplicationModule.cs index f5bfaa51c..f986fe3e2 100644 --- a/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/AbpMessageServiceApplicationModule.cs +++ b/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.Application/LINGYUN/Abp/MessageService/AbpMessageServiceApplicationModule.cs @@ -1,4 +1,4 @@ -using Volo.Abp.AutoMapper; +using Microsoft.Extensions.DependencyInjection; using Volo.Abp.Modularity; namespace LINGYUN.Abp.MessageService; @@ -10,9 +10,6 @@ public class AbpMessageServiceApplicationModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { - Configure(options => - { - options.AddProfile(validate: true); - }); + context.Services.AddMapperlyObjectMapper(); } } diff --git a/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.Domain/LINGYUN.Abp.MessageService.Domain.csproj b/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.Domain/LINGYUN.Abp.MessageService.Domain.csproj index 13bc3cfe8..7dbbe1cc1 100644 --- a/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.Domain/LINGYUN.Abp.MessageService.Domain.csproj +++ b/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.Domain/LINGYUN.Abp.MessageService.Domain.csproj @@ -16,7 +16,7 @@ - + diff --git a/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/AbpMessageServiceDomainModule.cs b/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/AbpMessageServiceDomainModule.cs index 52c35d44f..dabcb738b 100644 --- a/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/AbpMessageServiceDomainModule.cs +++ b/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/AbpMessageServiceDomainModule.cs @@ -1,19 +1,19 @@ using LINGYUN.Abp.IM.Localization; using LINGYUN.Abp.MessageService.Chat; using LINGYUN.Abp.MessageService.Localization; -using LINGYUN.Abp.MessageService.Mapper; using LINGYUN.Abp.MessageService.ObjectExtending; using LINGYUN.Abp.Notifications; -using Volo.Abp.AutoMapper; +using Microsoft.Extensions.DependencyInjection; using Volo.Abp.Caching; using Volo.Abp.Localization; +using Volo.Abp.Mapperly; using Volo.Abp.Modularity; using Volo.Abp.ObjectExtending.Modularity; namespace LINGYUN.Abp.MessageService; [DependsOn( - typeof(AbpAutoMapperModule), + typeof(AbpMapperlyModule), typeof(AbpCachingModule), typeof(AbpNotificationsModule), typeof(AbpMessageServiceDomainSharedModule))] @@ -21,10 +21,7 @@ public class AbpMessageServiceDomainModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { - Configure(options => - { - options.AddProfile(validate: true); - }); + context.Services.AddMapperlyObjectMapper(); Configure(options => { diff --git a/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Mapper/MessageServiceDomainAutoMapperProfile.cs b/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Mapper/MessageServiceDomainAutoMapperProfile.cs deleted file mode 100644 index 4a65347f8..000000000 --- a/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Mapper/MessageServiceDomainAutoMapperProfile.cs +++ /dev/null @@ -1,46 +0,0 @@ -using AutoMapper; -using LINGYUN.Abp.IM.Groups; -using LINGYUN.Abp.IM.Messages; -using LINGYUN.Abp.MessageService.Chat; -using LINGYUN.Abp.MessageService.Groups; -using Volo.Abp.AutoMapper; -using Volo.Abp.Data; -using Volo.Abp.ObjectExtending; - -namespace LINGYUN.Abp.MessageService.Mapper; - -public class MessageServiceDomainAutoMapperProfile : Profile -{ - public MessageServiceDomainAutoMapperProfile() - { - CreateMessageMap() - .ForMember(dto => dto.Content, map => map.MapFrom(src => src.Content)) - .ForMember(dto => dto.GroupId, map => map.MapFrom(src => src.GroupId.ToString())) - .Ignore(dto => dto.ToUserId); - - CreateMessageMap() - .ForMember(dto => dto.ToUserId, map => map.MapFrom(src => src.ReceiveUserId)) - .Ignore(dto => dto.GroupId); - - CreateMap() - .ForMember(g => g.Id, map => map.MapFrom(src => src.GroupId.ToString())) - .ForMember(g => g.MaxUserLength, map => map.MapFrom(src => src.MaxUserCount)) - .Ignore(g => g.GroupUserCount); - } - - protected IMappingExpression CreateMessageMap() - where TSource : Message - where TDestination : ChatMessage - { - return CreateMap() - .ForMember(dto => dto.Content, map => map.MapFrom(src => src.Content)) - .ForMember(dto => dto.MessageId, map => map.MapFrom(src => src.MessageId.ToString())) - .ForMember(dto => dto.FormUserId, map => map.MapFrom(src => src.CreatorId)) - .ForMember(dto => dto.FormUserName, map => map.MapFrom(src => src.SendUserName)) - .ForMember(dto => dto.SendTime, map => map.MapFrom(src => src.CreationTime)) - .ForMember(dto => dto.MessageType, map => map.MapFrom(src => src.Type)) - .ForMember(dto => dto.Source, map => map.MapFrom(src => src.Source)) - .ForMember(dto => dto.IsAnonymous, map => map.MapFrom(src => src.GetProperty(nameof(ChatMessage.IsAnonymous), false))) - .MapExtraProperties(MappingPropertyDefinitionChecks.None); - } -} diff --git a/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/MessageServiceDomainMappers.cs b/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/MessageServiceDomainMappers.cs new file mode 100644 index 000000000..37143a90d --- /dev/null +++ b/aspnet-core/modules/realtime-message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/MessageServiceDomainMappers.cs @@ -0,0 +1,79 @@ +using LINGYUN.Abp.IM.Groups; +using LINGYUN.Abp.IM.Messages; +using LINGYUN.Abp.MessageService.Chat; +using LINGYUN.Abp.MessageService.Groups; +using Riok.Mapperly.Abstractions; +using Volo.Abp.Data; +using Volo.Abp.Mapperly; +using Volo.Abp.ObjectExtending; + +namespace LINGYUN.Abp.MessageService; + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +[MapExtraProperties(DefinitionChecks = MappingPropertyDefinitionChecks.None)] +public partial class GroupMessageToChatMessageMapper : MapperBase +{ + [MapProperty(nameof(GroupMessage.GroupId), nameof(ChatMessage.GroupId))] + [MapProperty(nameof(GroupMessage.CreatorId), nameof(ChatMessage.FormUserId))] + [MapProperty(nameof(GroupMessage.SendUserName), nameof(ChatMessage.FormUserName))] + [MapProperty(nameof(GroupMessage.CreationTime), nameof(ChatMessage.SendTime))] + [MapProperty(nameof(GroupMessage.Type), nameof(ChatMessage.MessageType))] + [MapperIgnoreTarget(nameof(ChatMessage.ToUserId))] + [MapperIgnoreTarget(nameof(ChatMessage.IsAnonymous))] + public override partial ChatMessage Map(GroupMessage source); + + [MapProperty(nameof(GroupMessage.GroupId), nameof(ChatMessage.GroupId))] + [MapProperty(nameof(GroupMessage.CreatorId), nameof(ChatMessage.FormUserId))] + [MapProperty(nameof(GroupMessage.SendUserName), nameof(ChatMessage.FormUserName))] + [MapProperty(nameof(GroupMessage.CreationTime), nameof(ChatMessage.SendTime))] + [MapProperty(nameof(GroupMessage.Type), nameof(ChatMessage.MessageType))] + [MapperIgnoreTarget(nameof(ChatMessage.ToUserId))] + [MapperIgnoreTarget(nameof(ChatMessage.IsAnonymous))] + public override partial void Map(GroupMessage source, ChatMessage destination); + + public override void AfterMap(GroupMessage source, ChatMessage destination) + { + destination.IsAnonymous = source.GetProperty(nameof(ChatMessage.IsAnonymous), false); + } +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +[MapExtraProperties(DefinitionChecks = MappingPropertyDefinitionChecks.None)] +public partial class UserMessageToChatMessageMapper : MapperBase +{ + [MapProperty(nameof(UserMessage.ReceiveUserId), nameof(ChatMessage.ToUserId))] + [MapProperty(nameof(UserMessage.CreatorId), nameof(ChatMessage.FormUserId))] + [MapProperty(nameof(UserMessage.SendUserName), nameof(ChatMessage.FormUserName))] + [MapProperty(nameof(UserMessage.CreationTime), nameof(ChatMessage.SendTime))] + [MapProperty(nameof(UserMessage.Type), nameof(ChatMessage.MessageType))] + [MapperIgnoreTarget(nameof(ChatMessage.GroupId))] + [MapperIgnoreTarget(nameof(ChatMessage.IsAnonymous))] + public override partial ChatMessage Map(UserMessage source); + + [MapProperty(nameof(UserMessage.ReceiveUserId), nameof(ChatMessage.ToUserId))] + [MapProperty(nameof(UserMessage.CreatorId), nameof(ChatMessage.FormUserId))] + [MapProperty(nameof(UserMessage.SendUserName), nameof(ChatMessage.FormUserName))] + [MapProperty(nameof(UserMessage.CreationTime), nameof(ChatMessage.SendTime))] + [MapProperty(nameof(UserMessage.Type), nameof(ChatMessage.MessageType))] + [MapperIgnoreTarget(nameof(ChatMessage.GroupId))] + [MapperIgnoreTarget(nameof(ChatMessage.IsAnonymous))] + public override partial void Map(UserMessage source, ChatMessage destination); + public override void AfterMap(UserMessage source, ChatMessage destination) + { + destination.IsAnonymous = source.GetProperty(nameof(ChatMessage.IsAnonymous), false); + } +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class ChatGroupToGroupMapper : MapperBase +{ + [MapProperty(nameof(ChatGroup.GroupId), nameof(Group.Id))] + [MapProperty(nameof(ChatGroup.MaxUserCount), nameof(Group.MaxUserLength))] + [MapperIgnoreTarget(nameof(Group.GroupUserCount))] + public override partial Group Map(ChatGroup source); + + [MapProperty(nameof(ChatGroup.GroupId), nameof(Group.Id))] + [MapProperty(nameof(ChatGroup.MaxUserCount), nameof(Group.MaxUserLength))] + [MapperIgnoreTarget(nameof(Group.GroupUserCount))] + public override partial void Map(ChatGroup source, Group destination); +} diff --git a/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Application/LINGYUN/Abp/Notifications/AbpNotificationsApplicationAutoMapperProfile.cs b/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Application/LINGYUN/Abp/Notifications/AbpNotificationsApplicationAutoMapperProfile.cs deleted file mode 100644 index d3f0b8623..000000000 --- a/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Application/LINGYUN/Abp/Notifications/AbpNotificationsApplicationAutoMapperProfile.cs +++ /dev/null @@ -1,31 +0,0 @@ -using AutoMapper; -using System; - -namespace LINGYUN.Abp.Notifications; - -public class AbpNotificationsApplicationAutoMapperProfile : Profile -{ - public AbpNotificationsApplicationAutoMapperProfile() - { - CreateMap() - .ForMember(dto => dto.Id, map => map.MapFrom(src => src.NotificationId.ToString())) - .ForMember(dto => dto.Lifetime, map => map.Ignore()) - .ForMember(dto => dto.Data, map => map.MapFrom((src, nfi) => - { - if (src != null) - { - var dataType = Type.GetType(src.NotificationTypeName); - if (dataType != null) - { - var data = Activator.CreateInstance(dataType); - if (data is NotificationData notificationData) - { - notificationData.ExtraProperties = src.ExtraProperties; - return notificationData; - } - } - } - return new NotificationData(); - })); - } -} diff --git a/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Application/LINGYUN/Abp/Notifications/AbpNotificationsApplicationMappers.cs b/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Application/LINGYUN/Abp/Notifications/AbpNotificationsApplicationMappers.cs new file mode 100644 index 000000000..440ccc130 --- /dev/null +++ b/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Application/LINGYUN/Abp/Notifications/AbpNotificationsApplicationMappers.cs @@ -0,0 +1,35 @@ +using Riok.Mapperly.Abstractions; +using System; +using Volo.Abp.Mapperly; + +namespace LINGYUN.Abp.Notifications; + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class UserNotificationInfoToUserNotificationDtoMapper : MapperBase +{ + [MapProperty(nameof(UserNotificationInfo.NotificationId), nameof(UserNotificationDto.Id))] + [MapperIgnoreTarget(nameof(UserNotificationDto.Lifetime))] + [MapPropertyFromSource(nameof(UserNotificationDto.Data), Use = nameof(TryGetNotificationData))] + public override partial UserNotificationDto Map(UserNotificationInfo source); + + [MapProperty(nameof(UserNotificationInfo.NotificationId), nameof(UserNotificationDto.Id))] + [MapperIgnoreTarget(nameof(UserNotificationDto.Lifetime))] + [MapPropertyFromSource(nameof(UserNotificationDto.Data), Use = nameof(TryGetNotificationData))] + public override partial void Map(UserNotificationInfo source, UserNotificationDto destination); + + [UserMapping(Default = false)] + private static NotificationData TryGetNotificationData(UserNotificationInfo source) + { + if (source != null) + { + var dataType = Type.GetType(source.NotificationTypeName); + var data = Activator.CreateInstance(dataType); + if (data is NotificationData notificationData) + { + notificationData.ExtraProperties = source.ExtraProperties; + return notificationData; + } + } + return new NotificationData(); + } +} diff --git a/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Application/LINGYUN/Abp/Notifications/AbpNotificationsApplicationModule.cs b/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Application/LINGYUN/Abp/Notifications/AbpNotificationsApplicationModule.cs index 20d8e9044..3f0bf47fe 100644 --- a/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Application/LINGYUN/Abp/Notifications/AbpNotificationsApplicationModule.cs +++ b/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Application/LINGYUN/Abp/Notifications/AbpNotificationsApplicationModule.cs @@ -1,6 +1,5 @@ using Microsoft.Extensions.DependencyInjection; using Volo.Abp.Application; -using Volo.Abp.AutoMapper; using Volo.Abp.Modularity; namespace LINGYUN.Abp.Notifications; @@ -13,11 +12,6 @@ public class AbpNotificationsApplicationModule : 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/realtime-notifications/LINGYUN.Abp.Notifications.Domain/LINGYUN.Abp.Notifications.Domain.csproj b/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Domain/LINGYUN.Abp.Notifications.Domain.csproj index d39870f33..0da786109 100644 --- a/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Domain/LINGYUN.Abp.Notifications.Domain.csproj +++ b/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Domain/LINGYUN.Abp.Notifications.Domain.csproj @@ -16,7 +16,7 @@ - + diff --git a/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Domain/LINGYUN/Abp/Notifications/AbpNotificationsDomainAutoMapperProfile.cs b/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Domain/LINGYUN/Abp/Notifications/AbpNotificationsDomainAutoMapperProfile.cs deleted file mode 100644 index 21a144526..000000000 --- a/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Domain/LINGYUN/Abp/Notifications/AbpNotificationsDomainAutoMapperProfile.cs +++ /dev/null @@ -1,52 +0,0 @@ -using AutoMapper; -using System; - -namespace LINGYUN.Abp.Notifications; - -public class AbpNotificationsDomainAutoMapperProfile : Profile -{ - public AbpNotificationsDomainAutoMapperProfile() - { - CreateMap() - .ForMember(dto => dto.Id, map => map.MapFrom(src => src.NotificationId.ToString())) - .ForMember(dto => dto.Name, map => map.MapFrom(src => src.NotificationName)) - .ForMember(dto => dto.Lifetime, map => map.Ignore()) - .ForMember(dto => dto.Type, map => map.MapFrom(src => src.Type)) - .ForMember(dto => dto.ContentType, map => map.MapFrom(src => src.ContentType)) - .ForMember(dto => dto.Severity, map => map.MapFrom(src => src.Severity)) - .ForMember(dto => dto.CreationTime, map => map.MapFrom(src => src.CreationTime)) - .ForMember(dto => dto.Data, map => map.MapFrom((src, nfi) => - { - var dataType = Type.GetType(src.NotificationTypeName); - var data = Activator.CreateInstance(dataType); - if (data is NotificationData notificationData) - { - notificationData.ExtraProperties = src.ExtraProperties; - return notificationData; - } - return new NotificationData(); - })); - - CreateMap() - .ForMember(dto => dto.Id, map => map.MapFrom(src => src.NotificationId.ToString())) - .ForMember(dto => dto.Name, map => map.MapFrom(src => src.Name)) - .ForMember(dto => dto.Lifetime, map => map.Ignore()) - .ForMember(dto => dto.Type, map => map.MapFrom(src => src.Type)) - .ForMember(dto => dto.ContentType, map => map.MapFrom(src => src.ContentType)) - .ForMember(dto => dto.Severity, map => map.MapFrom(src => src.Severity)) - .ForMember(dto => dto.CreationTime, map => map.MapFrom(src => src.CreationTime)) - .ForMember(dto => dto.Data, map => map.MapFrom((src, nfi) => - { - var dataType = Type.GetType(src.NotificationTypeName); - var data = Activator.CreateInstance(dataType); - if (data is NotificationData notificationData) - { - notificationData.ExtraProperties = src.ExtraProperties; - return notificationData; - } - return new NotificationData(); - })); - - CreateMap(); - } -} diff --git a/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Domain/LINGYUN/Abp/Notifications/AbpNotificationsDomainMappers.cs b/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Domain/LINGYUN/Abp/Notifications/AbpNotificationsDomainMappers.cs new file mode 100644 index 000000000..d4cc272e1 --- /dev/null +++ b/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Domain/LINGYUN/Abp/Notifications/AbpNotificationsDomainMappers.cs @@ -0,0 +1,76 @@ +using Riok.Mapperly.Abstractions; +using System; +using Volo.Abp.Mapperly; + +namespace LINGYUN.Abp.Notifications; + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class NotificationToNotificationInfoMapper : MapperBase +{ + [MapProperty(nameof(Notification.NotificationId), nameof(NotificationInfo.Id))] + [MapProperty(nameof(Notification.NotificationName), nameof(NotificationInfo.Name))] + [MapperIgnoreTarget(nameof(NotificationInfo.Lifetime))] + [MapPropertyFromSource(nameof(NotificationInfo.Data), Use = nameof(TryGetNotificationData))] + public override partial NotificationInfo Map(Notification source); + + [MapProperty(nameof(Notification.NotificationId), nameof(NotificationInfo.Id))] + [MapProperty(nameof(Notification.NotificationName), nameof(NotificationInfo.Name))] + [MapperIgnoreTarget(nameof(NotificationInfo.Lifetime))] + [MapPropertyFromSource(nameof(NotificationInfo.Data), Use = nameof(TryGetNotificationData))] + public override partial void Map(Notification source, NotificationInfo destination); + + [UserMapping(Default = false)] + private static NotificationData TryGetNotificationData(Notification source) + { + if (source != null) + { + var dataType = Type.GetType(source.NotificationTypeName); + var data = Activator.CreateInstance(dataType); + if (data is NotificationData notificationData) + { + notificationData.ExtraProperties = source.ExtraProperties; + return notificationData; + } + } + return new NotificationData(); + } +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class UserNotificationInfoToNotificationInfoMapper : MapperBase +{ + [MapProperty(nameof(UserNotificationInfo.NotificationId), nameof(NotificationInfo.Id))] + [MapProperty(nameof(UserNotificationInfo.Name), nameof(NotificationInfo.Name))] + [MapperIgnoreTarget(nameof(NotificationInfo.Lifetime))] + [MapPropertyFromSource(nameof(NotificationInfo.Data), Use = nameof(TryGetNotificationData))] + public override partial NotificationInfo Map(UserNotificationInfo source); + + [MapProperty(nameof(UserNotificationInfo.NotificationId), nameof(NotificationInfo.Id))] + [MapProperty(nameof(UserNotificationInfo.Name), nameof(NotificationInfo.Name))] + [MapperIgnoreTarget(nameof(NotificationInfo.Lifetime))] + [MapPropertyFromSource(nameof(NotificationInfo.Data), Use = nameof(TryGetNotificationData))] + public override partial void Map(UserNotificationInfo source, NotificationInfo destination); + + [UserMapping(Default = false)] + private static NotificationData TryGetNotificationData(UserNotificationInfo source) + { + if (source != null) + { + var dataType = Type.GetType(source.NotificationTypeName); + var data = Activator.CreateInstance(dataType); + if (data is NotificationData notificationData) + { + notificationData.ExtraProperties = source.ExtraProperties; + return notificationData; + } + } + return new NotificationData(); + } +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class UserSubscribeToNotificationSubscriptionInfoMapper : MapperBase +{ + public override partial NotificationSubscriptionInfo Map(UserSubscribe source); + public override partial void Map(UserSubscribe source, NotificationSubscriptionInfo destination); +} diff --git a/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Domain/LINGYUN/Abp/Notifications/AbpNotificationsDomainModule.cs b/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Domain/LINGYUN/Abp/Notifications/AbpNotificationsDomainModule.cs index ecc6034de..4c1745b28 100644 --- a/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Domain/LINGYUN/Abp/Notifications/AbpNotificationsDomainModule.cs +++ b/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Domain/LINGYUN/Abp/Notifications/AbpNotificationsDomainModule.cs @@ -2,9 +2,9 @@ using System.Threading; using System.Threading.Tasks; using Volo.Abp; -using Volo.Abp.AutoMapper; using Volo.Abp.Caching; using Volo.Abp.Data; +using Volo.Abp.Mapperly; using Volo.Abp.Modularity; using Volo.Abp.Threading; @@ -12,7 +12,7 @@ namespace LINGYUN.Abp.Notifications; [DependsOn( typeof(AbpCachingModule), - typeof(AbpAutoMapperModule), + typeof(AbpMapperlyModule), typeof(AbpNotificationsModule), typeof(AbpNotificationsDomainSharedModule))] public class AbpNotificationsDomainModule : AbpModule @@ -21,6 +21,8 @@ public class AbpNotificationsDomainModule : AbpModule public override void ConfigureServices(ServiceConfigurationContext context) { + context.Services.AddMapperlyObjectMapper(); + if (context.Services.IsDataMigrationEnvironment()) { Configure(options => @@ -29,11 +31,6 @@ public class AbpNotificationsDomainModule : AbpModule options.IsDynamicNotificationsStoreEnabled = false; }); } - - Configure(options => - { - options.AddProfile(validate: true); - }); } public override void OnApplicationInitialization(ApplicationInitializationContext context) diff --git a/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.EntityFrameworkCore/LINGYUN/Abp/Notifications/EntityFrameworkCore/AbpNotificationsEntityFrameworkCoreModule.cs b/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.EntityFrameworkCore/LINGYUN/Abp/Notifications/EntityFrameworkCore/AbpNotificationsEntityFrameworkCoreModule.cs index 715d855a2..44b87f57c 100644 --- a/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.EntityFrameworkCore/LINGYUN/Abp/Notifications/EntityFrameworkCore/AbpNotificationsEntityFrameworkCoreModule.cs +++ b/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.EntityFrameworkCore/LINGYUN/Abp/Notifications/EntityFrameworkCore/AbpNotificationsEntityFrameworkCoreModule.cs @@ -1,5 +1,4 @@ using Microsoft.Extensions.DependencyInjection; -using Volo.Abp.AutoMapper; using Volo.Abp.Caching; using Volo.Abp.Modularity; @@ -7,7 +6,6 @@ namespace LINGYUN.Abp.Notifications.EntityFrameworkCore; [DependsOn( typeof(AbpCachingModule), - typeof(AbpAutoMapperModule), typeof(AbpNotificationsDomainModule))] public class AbpNotificationsEntityFrameworkCoreModule : AbpModule { diff --git a/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Application/LINGYUN/Abp/Saas/AbpSaasApplicationAutoMapperProfile.cs b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Application/LINGYUN/Abp/Saas/AbpSaasApplicationAutoMapperProfile.cs deleted file mode 100644 index 8426fbfcd..000000000 --- a/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Application/LINGYUN/Abp/Saas/AbpSaasApplicationAutoMapperProfile.cs +++ /dev/null @@ -1,33 +0,0 @@ -using AutoMapper; -using LINGYUN.Abp.Saas.Editions; -using LINGYUN.Abp.Saas.Tenants; - -namespace LINGYUN.Abp.Saas; - -public class AbpSaasApplicationAutoMapperProfile : Profile -{ - public AbpSaasApplicationAutoMapperProfile() - { - CreateMap(); - - CreateMap() - .ForMember(dto => dto.EditionId, map => - { - map.MapFrom((tenant, dto) => - { - return tenant.Edition?.Id; - }); - }) - .ForMember(dto => dto.EditionName, map => - { - map.MapFrom((tenant, dto) => - { - return tenant.Edition?.DisplayName; - }); - }) - .MapExtraProperties(); - - CreateMap() - .MapExtraProperties(); - } -} diff --git a/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Application/LINGYUN/Abp/Saas/AbpSaasApplicationMappers.cs b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Application/LINGYUN/Abp/Saas/AbpSaasApplicationMappers.cs new file mode 100644 index 000000000..a6141f1cc --- /dev/null +++ b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Application/LINGYUN/Abp/Saas/AbpSaasApplicationMappers.cs @@ -0,0 +1,37 @@ +using LINGYUN.Abp.Saas.Editions; +using LINGYUN.Abp.Saas.Tenants; +using Riok.Mapperly.Abstractions; +using Volo.Abp.Mapperly; + +namespace LINGYUN.Abp.Saas; + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class TenantConnectionStringToTenantConnectionStringDtoMapper : MapperBase +{ + public override partial TenantConnectionStringDto Map(TenantConnectionString source); + public override partial void Map(TenantConnectionString source, TenantConnectionStringDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class TenantToTenantDtoMapper : MapperBase +{ + [MapPropertyFromSource(nameof(TenantDto.EditionName), Use = nameof(TryGetEditionName))] + public override partial TenantDto Map(Tenant source); + + [MapPropertyFromSource(nameof(TenantDto.EditionName), Use = nameof(TryGetEditionName))] + public override partial void Map(Tenant source, TenantDto destination); + + private static string TryGetEditionName(Tenant source) + { + return source?.Edition?.DisplayName; + } +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +[MapExtraProperties] +public partial class EditionToEditionDtoMapper : MapperBase +{ + public override partial EditionDto Map(Edition source); + public override partial void Map(Edition source, EditionDto destination); +} + diff --git a/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Application/LINGYUN/Abp/Saas/AbpSaasApplicationModule.cs b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Application/LINGYUN/Abp/Saas/AbpSaasApplicationModule.cs index bb9fc9d1f..103895223 100644 --- a/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Application/LINGYUN/Abp/Saas/AbpSaasApplicationModule.cs +++ b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Application/LINGYUN/Abp/Saas/AbpSaasApplicationModule.cs @@ -1,5 +1,4 @@ using Microsoft.Extensions.DependencyInjection; -using Volo.Abp.AutoMapper; using Volo.Abp.Modularity; namespace LINGYUN.Abp.Saas; @@ -10,10 +9,6 @@ public class AbpSaasApplicationModule : 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/saas/LINGYUN.Abp.Saas.Domain/LINGYUN.Abp.Saas.Domain.csproj b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain/LINGYUN.Abp.Saas.Domain.csproj index c2f17c4d7..4dd2df5ee 100644 --- a/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain/LINGYUN.Abp.Saas.Domain.csproj +++ b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain/LINGYUN.Abp.Saas.Domain.csproj @@ -14,7 +14,7 @@ - + diff --git a/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain/LINGYUN/Abp/Saas/AbpSaasDomainMappers.cs b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain/LINGYUN/Abp/Saas/AbpSaasDomainMappers.cs new file mode 100644 index 000000000..14f8a92b5 --- /dev/null +++ b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain/LINGYUN/Abp/Saas/AbpSaasDomainMappers.cs @@ -0,0 +1,77 @@ +using LINGYUN.Abp.MultiTenancy.Editions; +using LINGYUN.Abp.Saas.Editions; +using LINGYUN.Abp.Saas.Tenants; +using Riok.Mapperly.Abstractions; +using System; +using Volo.Abp.Data; +using Volo.Abp.Mapperly; +using Volo.Abp.MultiTenancy; + +namespace LINGYUN.Abp.Saas; + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class EditionToEditionInfoMapper : MapperBase +{ + public override partial EditionInfo Map(Edition source); + public override partial void Map(Edition source, EditionInfo destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class EditionToEditionEtoMapper : MapperBase +{ + public override partial EditionEto Map(Edition source); + public override partial void Map(Edition source, EditionEto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class TenantToTenantConfigurationMapper : MapperBase +{ + [MapPropertyFromSource(nameof(TenantConfiguration.ConnectionStrings), Use = nameof(TryGetConnectionStrings))] + [MapPropertyFromSource(nameof(TenantConfiguration.IsActive), Use = nameof(TryGetIsActive))] + public override partial TenantConfiguration Map(Tenant source); + + [MapPropertyFromSource(nameof(TenantConfiguration.ConnectionStrings), Use = nameof(TryGetConnectionStrings))] + [MapPropertyFromSource(nameof(TenantConfiguration.IsActive), Use = nameof(TryGetIsActive))] + public override partial void Map(Tenant source, TenantConfiguration destination); + + [UserMapping] + private static ConnectionStrings TryGetConnectionStrings(Tenant source) + { + var connStrings = new ConnectionStrings(); + + foreach (var connectionString in source.ConnectionStrings) + { + connStrings[connectionString.Name] = connectionString.Value; + } + + return connStrings; + } + + [UserMapping] + private static bool TryGetIsActive(Tenant source) + { + if (!source.IsActive) + { + return false; + } + // Injection IClock ? + if (source.EnableTime.HasValue && DateTime.Now < source.EnableTime) + { + return false; + } + + if (source.DisableTime.HasValue && DateTime.Now > source.DisableTime) + { + return false; + } + + return true; + } +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class TenantToTenantEtoMapper : MapperBase +{ + public override partial TenantEto Map(Tenant source); + public override partial void Map(Tenant source, TenantEto destination); +} diff --git a/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain/LINGYUN/Abp/Saas/AbpSaasDomainMappingProfile.cs b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain/LINGYUN/Abp/Saas/AbpSaasDomainMappingProfile.cs deleted file mode 100644 index 39a22d50c..000000000 --- a/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain/LINGYUN/Abp/Saas/AbpSaasDomainMappingProfile.cs +++ /dev/null @@ -1,58 +0,0 @@ -using AutoMapper; -using LINGYUN.Abp.MultiTenancy.Editions; -using LINGYUN.Abp.Saas.Editions; -using LINGYUN.Abp.Saas.Tenants; -using System; -using Volo.Abp.Data; -using Volo.Abp.MultiTenancy; - -namespace LINGYUN.Abp.Saas; - -public class AbpSaasDomainMappingProfile : Profile -{ - public AbpSaasDomainMappingProfile() - { - CreateMap(); - CreateMap(); - - CreateMap() - .ForMember(ti => ti.ConnectionStrings, opts => - { - opts.MapFrom((tenant, ti) => - { - var connStrings = new ConnectionStrings(); - - foreach (var connectionString in tenant.ConnectionStrings) - { - connStrings[connectionString.Name] = connectionString.Value; - } - - return connStrings; - }); - }) - .ForMember(ti => ti.IsActive, opts => - { - opts.MapFrom((tenant, ti) => - { - if (!tenant.IsActive) - { - return false; - } - // Injection IClock ? - if (tenant.EnableTime.HasValue && DateTime.Now < tenant.EnableTime) - { - return false; - } - - if(tenant.DisableTime.HasValue && DateTime.Now > tenant.DisableTime) - { - return false; - } - - return true; - }); - }); - - CreateMap(); - } -} diff --git a/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain/LINGYUN/Abp/Saas/AbpSaasDomainModule.cs b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain/LINGYUN/Abp/Saas/AbpSaasDomainModule.cs index 6cf3abdf8..f191b4bb4 100644 --- a/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain/LINGYUN/Abp/Saas/AbpSaasDomainModule.cs +++ b/aspnet-core/modules/saas/LINGYUN.Abp.Saas.Domain/LINGYUN/Abp/Saas/AbpSaasDomainModule.cs @@ -3,9 +3,9 @@ using LINGYUN.Abp.Saas.Editions; using LINGYUN.Abp.Saas.ObjectExtending; using LINGYUN.Abp.Saas.Tenants; using Microsoft.Extensions.DependencyInjection; -using Volo.Abp.AutoMapper; using Volo.Abp.Domain; using Volo.Abp.Domain.Entities.Events.Distributed; +using Volo.Abp.Mapperly; using Volo.Abp.Modularity; using Volo.Abp.ObjectExtending.Modularity; using Volo.Abp.Threading; @@ -13,7 +13,7 @@ using Volo.Abp.Threading; namespace LINGYUN.Abp.Saas; [DependsOn(typeof(AbpSaasDomainSharedModule))] -[DependsOn(typeof(AbpAutoMapperModule))] +[DependsOn(typeof(AbpMapperlyModule))] [DependsOn(typeof(AbpDddDomainModule))] [DependsOn(typeof(AbpMultiTenancyEditionsModule))] public class AbpSaasDomainModule : AbpModule @@ -22,12 +22,7 @@ public class AbpSaasDomainModule : 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/task-management/LINGYUN.Abp.BackgroundTasks/LINGYUN/Abp/BackgroundTasks/BackgroundWorkerAdapter.cs b/aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks/LINGYUN/Abp/BackgroundTasks/BackgroundWorkerAdapter.cs index 2fcaca088..0f73f6e86 100644 --- a/aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks/LINGYUN/Abp/BackgroundTasks/BackgroundWorkerAdapter.cs +++ b/aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks/LINGYUN/Abp/BackgroundTasks/BackgroundWorkerAdapter.cs @@ -61,7 +61,7 @@ public class BackgroundWorkerAdapter : BackgroundWorkerBase, IBackgroun var jobArgs = new Dictionary { - { "JobType", workerType.AssemblyQualifiedName }, + { "JobType", workerType.AssemblyQualifiedName! }, }; return new JobInfo { diff --git a/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Application/LINGYUN/Abp/TaskManagement/TaskManagementApplicationMapperProfile.cs b/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Application/LINGYUN/Abp/TaskManagement/TaskManagementApplicationMapperProfile.cs deleted file mode 100644 index 634871150..000000000 --- a/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Application/LINGYUN/Abp/TaskManagement/TaskManagementApplicationMapperProfile.cs +++ /dev/null @@ -1,13 +0,0 @@ -using AutoMapper; - -namespace LINGYUN.Abp.TaskManagement; - -public class TaskManagementApplicationMapperProfile : Profile -{ - public TaskManagementApplicationMapperProfile() - { - CreateMap(); - CreateMap(); - CreateMap(); - } -} diff --git a/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Application/LINGYUN/Abp/TaskManagement/TaskManagementApplicationMappers.cs b/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Application/LINGYUN/Abp/TaskManagement/TaskManagementApplicationMappers.cs new file mode 100644 index 000000000..3f1e47fd8 --- /dev/null +++ b/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Application/LINGYUN/Abp/TaskManagement/TaskManagementApplicationMappers.cs @@ -0,0 +1,25 @@ +using Riok.Mapperly.Abstractions; +using Volo.Abp.Mapperly; + +namespace LINGYUN.Abp.TaskManagement; + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class BackgroundJobInfoToBackgroundJobInfoDtoMapper : MapperBase +{ + public override partial BackgroundJobInfoDto Map(BackgroundJobInfo source); + public override partial void Map(BackgroundJobInfo source, BackgroundJobInfoDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class BackgroundJobLogToBackgroundJobLogDtoMapper : MapperBase +{ + public override partial BackgroundJobLogDto Map(BackgroundJobLog source); + public override partial void Map(BackgroundJobLog source, BackgroundJobLogDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class BackgroundJobActionToBackgroundJobActionDtoMapper : MapperBase +{ + public override partial BackgroundJobActionDto Map(BackgroundJobAction source); + public override partial void Map(BackgroundJobAction source, BackgroundJobActionDto destination); +} diff --git a/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Application/LINGYUN/Abp/TaskManagement/TaskManagementApplicationModule.cs b/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Application/LINGYUN/Abp/TaskManagement/TaskManagementApplicationModule.cs index e9beb4275..403144c77 100644 --- a/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Application/LINGYUN/Abp/TaskManagement/TaskManagementApplicationModule.cs +++ b/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Application/LINGYUN/Abp/TaskManagement/TaskManagementApplicationModule.cs @@ -1,7 +1,6 @@ using LINGYUN.Abp.Dynamic.Queryable; using Microsoft.Extensions.DependencyInjection; using Volo.Abp.Application; -using Volo.Abp.AutoMapper; using Volo.Abp.Modularity; namespace LINGYUN.Abp.TaskManagement; @@ -14,11 +13,6 @@ public class TaskManagementApplicationModule : 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/task-management/LINGYUN.Abp.TaskManagement.Domain/LINGYUN.Abp.TaskManagement.Domain.csproj b/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Domain/LINGYUN.Abp.TaskManagement.Domain.csproj index 99805fbb0..f91aa5f4e 100644 --- a/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Domain/LINGYUN.Abp.TaskManagement.Domain.csproj +++ b/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Domain/LINGYUN.Abp.TaskManagement.Domain.csproj @@ -14,7 +14,7 @@ - + diff --git a/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Domain/LINGYUN/Abp/TaskManagement/TaskManagementDomainMapperProfile.cs b/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Domain/LINGYUN/Abp/TaskManagement/TaskManagementDomainMapperProfile.cs deleted file mode 100644 index bd169d073..000000000 --- a/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Domain/LINGYUN/Abp/TaskManagement/TaskManagementDomainMapperProfile.cs +++ /dev/null @@ -1,13 +0,0 @@ -using AutoMapper; -using LINGYUN.Abp.BackgroundTasks; - -namespace LINGYUN.Abp.TaskManagement; - -public class TaskManagementDomainMapperProfile : Profile -{ - public TaskManagementDomainMapperProfile() - { - CreateMap(); - CreateMap(); - } -} diff --git a/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Domain/LINGYUN/Abp/TaskManagement/TaskManagementDomainMappers.cs b/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Domain/LINGYUN/Abp/TaskManagement/TaskManagementDomainMappers.cs new file mode 100644 index 000000000..f073f5964 --- /dev/null +++ b/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Domain/LINGYUN/Abp/TaskManagement/TaskManagementDomainMappers.cs @@ -0,0 +1,29 @@ +using LINGYUN.Abp.BackgroundTasks; +using Riok.Mapperly.Abstractions; +using Volo.Abp.Mapperly; + +namespace LINGYUN.Abp.TaskManagement; + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class BackgroundJobInfoToJobInfoMapper : MapperBase +{ + [MapperIgnoreTarget(nameof(JobInfo.Args))] + [MapperIgnoreSource(nameof(BackgroundJobInfo.Args))] + public override partial JobInfo Map(BackgroundJobInfo source); + + [MapperIgnoreTarget(nameof(JobInfo.Args))] + [MapperIgnoreSource(nameof(BackgroundJobInfo.Args))] + public override partial void Map(BackgroundJobInfo source, JobInfo destination); + + public override void AfterMap(BackgroundJobInfo source, JobInfo destination) + { + destination.Args = source.Args; + } +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class BackgroundJobInfoToBackgroundJobEtoMapper : MapperBase +{ + public override partial BackgroundJobEto Map(BackgroundJobInfo source); + public override partial void Map(BackgroundJobInfo source, BackgroundJobEto destination); +} diff --git a/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Domain/LINGYUN/Abp/TaskManagement/TaskManagementDomainModule.cs b/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Domain/LINGYUN/Abp/TaskManagement/TaskManagementDomainModule.cs index 37c022960..23bf42479 100644 --- a/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Domain/LINGYUN/Abp/TaskManagement/TaskManagementDomainModule.cs +++ b/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.Domain/LINGYUN/Abp/TaskManagement/TaskManagementDomainModule.cs @@ -2,15 +2,15 @@ using LINGYUN.Abp.BackgroundTasks.Activities; using LINGYUN.Abp.BackgroundTasks.EventBus; using Microsoft.Extensions.DependencyInjection; -using Volo.Abp.AutoMapper; using Volo.Abp.Domain; using Volo.Abp.Domain.Entities.Events.Distributed; +using Volo.Abp.Mapperly; using Volo.Abp.Modularity; namespace LINGYUN.Abp.TaskManagement; [DependsOn(typeof(TaskManagementDomainSharedModule))] -[DependsOn(typeof(AbpAutoMapperModule))] +[DependsOn(typeof(AbpMapperlyModule))] [DependsOn(typeof(AbpDddDomainModule))] [DependsOn(typeof(AbpBackgroundTasksModule))] [DependsOn(typeof(AbpBackgroundTasksEventBusModule))] @@ -19,12 +19,7 @@ public class TaskManagementDomainModule : 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/text-templating/LINGYUN.Abp.TextTemplating.Application/LINGYUN.Abp.TextTemplating.Application.csproj b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/LINGYUN.Abp.TextTemplating.Application.csproj index b5cef8613..fcdfd0c7d 100644 --- a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/LINGYUN.Abp.TextTemplating.Application.csproj +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/LINGYUN.Abp.TextTemplating.Application.csproj @@ -15,7 +15,6 @@ - diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/LINGYUN/Abp/TextTemplating/AbpTextTemplatingApplicationAutoMapperProfile.cs b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/LINGYUN/Abp/TextTemplating/AbpTextTemplatingApplicationAutoMapperProfile.cs deleted file mode 100644 index bce5e1104..000000000 --- a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/LINGYUN/Abp/TextTemplating/AbpTextTemplatingApplicationAutoMapperProfile.cs +++ /dev/null @@ -1,11 +0,0 @@ -using AutoMapper; - -namespace LINGYUN.Abp.TextTemplating; - -public class AbpTextTemplatingApplicationAutoMapperProfile : Profile -{ - public AbpTextTemplatingApplicationAutoMapperProfile() - { - CreateMap(); - } -} diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/LINGYUN/Abp/TextTemplating/AbpTextTemplatingApplicationModule.cs b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/LINGYUN/Abp/TextTemplating/AbpTextTemplatingApplicationModule.cs index 5ab7ee8a0..9bd3f1697 100644 --- a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/LINGYUN/Abp/TextTemplating/AbpTextTemplatingApplicationModule.cs +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/LINGYUN/Abp/TextTemplating/AbpTextTemplatingApplicationModule.cs @@ -1,6 +1,5 @@ using Microsoft.Extensions.DependencyInjection; using Volo.Abp.Application; -using Volo.Abp.AutoMapper; using Volo.Abp.Modularity; namespace LINGYUN.Abp.TextTemplating; @@ -8,16 +7,11 @@ namespace LINGYUN.Abp.TextTemplating; [DependsOn( typeof(AbpTextTemplatingDomainModule), typeof(AbpTextTemplatingApplicationContractsModule), - typeof(AbpAutoMapperModule), typeof(AbpDddApplicationModule))] public class AbpTextTemplatingApplicationModule : 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/text-templating/LINGYUN.Abp.TextTemplating.Application/LINGYUN/Abp/TextTemplating/TextTemplatingApplicationMappers.cs b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/LINGYUN/Abp/TextTemplating/TextTemplatingApplicationMappers.cs new file mode 100644 index 000000000..7aa5dd98b --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Application/LINGYUN/Abp/TextTemplating/TextTemplatingApplicationMappers.cs @@ -0,0 +1,11 @@ +using Riok.Mapperly.Abstractions; +using Volo.Abp.Mapperly; + +namespace LINGYUN.Abp.TextTemplating; + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class TextTemplateDefinitionToTextTemplateDefinitionDtoMapper : MapperBase +{ + public override partial TextTemplateDefinitionDto Map(TextTemplateDefinition source); + public override partial void Map(TextTemplateDefinition source, TextTemplateDefinitionDto destination); +} diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN.Abp.TextTemplating.Domain.csproj b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN.Abp.TextTemplating.Domain.csproj index 56691cd7f..4c65e0b56 100644 --- a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN.Abp.TextTemplating.Domain.csproj +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN.Abp.TextTemplating.Domain.csproj @@ -14,7 +14,7 @@ - + diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/AbpTextTemplatingDomainModule.cs b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/AbpTextTemplatingDomainModule.cs index a042827e0..a49283691 100644 --- a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/AbpTextTemplatingDomainModule.cs +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/AbpTextTemplatingDomainModule.cs @@ -2,10 +2,10 @@ using System.Threading; using System.Threading.Tasks; using Volo.Abp; -using Volo.Abp.AutoMapper; using Volo.Abp.Caching; using Volo.Abp.Data; using Volo.Abp.Domain.Entities.Events.Distributed; +using Volo.Abp.Mapperly; using Volo.Abp.Modularity; using Volo.Abp.TextTemplating; using Volo.Abp.Threading; @@ -15,7 +15,7 @@ namespace LINGYUN.Abp.TextTemplating; [DependsOn( typeof(AbpTextTemplatingDomainSharedModule), typeof(AbpTextTemplatingCoreModule), - typeof(AbpAutoMapperModule), + typeof(AbpMapperlyModule), typeof(AbpCachingModule))] public class AbpTextTemplatingDomainModule : AbpModule { @@ -23,12 +23,7 @@ public class AbpTextTemplatingDomainModule : 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/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/TextTemplateDomainMappers.cs b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/TextTemplateDomainMappers.cs new file mode 100644 index 000000000..5b00d894e --- /dev/null +++ b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/TextTemplateDomainMappers.cs @@ -0,0 +1,18 @@ +using Riok.Mapperly.Abstractions; +using Volo.Abp.Mapperly; + +namespace LINGYUN.Abp.TextTemplating; + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class TextTemplateToTextTemplateEtoMapper : MapperBase +{ + public override partial TextTemplateEto Map(TextTemplate source); + public override partial void Map(TextTemplate source, TextTemplateEto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class TextTemplateDefinitionToTextTemplateDefinitionEtoMapper : MapperBase +{ + public override partial TextTemplateDefinitionEto Map(TextTemplateDefinition source); + public override partial void Map(TextTemplateDefinition source, TextTemplateDefinitionEto destination); +} diff --git a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/TextTemplateMapperProfile.cs b/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/TextTemplateMapperProfile.cs deleted file mode 100644 index 355a66f7c..000000000 --- a/aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.Domain/LINGYUN/Abp/TextTemplating/TextTemplateMapperProfile.cs +++ /dev/null @@ -1,11 +0,0 @@ -using AutoMapper; - -namespace LINGYUN.Abp.TextTemplating; -public class TextTemplateMapperProfile : Profile -{ - public TextTemplateMapperProfile() - { - CreateMap(); - CreateMap(); - } -} diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application/LINGYUN/Abp/WebhooksManagement/WebhooksManagementApplicationMapperProfile.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application/LINGYUN/Abp/WebhooksManagement/WebhooksManagementApplicationMapperProfile.cs deleted file mode 100644 index 868ff31d6..000000000 --- a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application/LINGYUN/Abp/WebhooksManagement/WebhooksManagementApplicationMapperProfile.cs +++ /dev/null @@ -1,45 +0,0 @@ -using AutoMapper; -using System.Collections.Generic; -using System; -using Newtonsoft.Json; - -namespace LINGYUN.Abp.WebhooksManagement; - -public class WebhooksManagementApplicationMapperProfile : Profile -{ - public WebhooksManagementApplicationMapperProfile() - { - CreateMap(); - CreateMap() - .ForMember(dto => dto.RequestHeaders, map => map.MapFrom((src, dto) => - { - var result = new Dictionary(); - - if (src.RequestHeaders.IsNullOrWhiteSpace()) - { - try - { - result = JsonConvert.DeserializeObject< Dictionary>(src.RequestHeaders); - } - catch { } - } - - return result; - })) - .ForMember(dto => dto.ResponseHeaders, map => map.MapFrom((src, dto) => - { - var result = new Dictionary(); - - if (src.ResponseHeaders.IsNullOrWhiteSpace()) - { - try - { - result = JsonConvert.DeserializeObject>(src.ResponseHeaders); - } - catch { } - } - - return result; - })); - } -} diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application/LINGYUN/Abp/WebhooksManagement/WebhooksManagementApplicationMappers.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application/LINGYUN/Abp/WebhooksManagement/WebhooksManagementApplicationMappers.cs new file mode 100644 index 000000000..9636fed88 --- /dev/null +++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application/LINGYUN/Abp/WebhooksManagement/WebhooksManagementApplicationMappers.cs @@ -0,0 +1,66 @@ +using Newtonsoft.Json; +using Riok.Mapperly.Abstractions; +using System; +using System.Collections.Generic; +using Volo.Abp.Mapperly; + +namespace LINGYUN.Abp.WebhooksManagement; + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class WebhookEventRecordToWebhookEventRecordDtoMapper : MapperBase +{ + public override partial WebhookEventRecordDto Map(WebhookEventRecord source); + public override partial void Map(WebhookEventRecord source, WebhookEventRecordDto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class WebhookSendRecordToWebhookSendRecordDtoMapper : MapperBase +{ + [MapperIgnoreTarget(nameof(WebhookSendRecord.RequestHeaders))] + [MapperIgnoreTarget(nameof(WebhookSendRecord.ResponseHeaders))] + public override partial WebhookSendRecordDto Map(WebhookSendRecord source); + + [MapperIgnoreTarget(nameof(WebhookSendRecord.RequestHeaders))] + [MapperIgnoreTarget(nameof(WebhookSendRecord.ResponseHeaders))] + public override partial void Map(WebhookSendRecord source, WebhookSendRecordDto destination); + + public override void AfterMap(WebhookSendRecord source, WebhookSendRecordDto destination) + { + destination.RequestHeaders = TryGetRequestHeaders(source.RequestHeaders); + destination.ResponseHeaders = TryGetResponseHeaders(source.ResponseHeaders); + } + + [UserMapping(Ignore = true)] + private static IDictionary TryGetRequestHeaders(string requestHeaders) + { + var result = new Dictionary(); + + if (!requestHeaders.IsNullOrWhiteSpace()) + { + try + { + result = JsonConvert.DeserializeObject>(requestHeaders); + } + catch { } + } + + return result; + } + + [UserMapping(Ignore = true)] + private static IDictionary TryGetResponseHeaders(string responseHeaders) + { + var result = new Dictionary(); + + if (!responseHeaders.IsNullOrWhiteSpace()) + { + try + { + result = JsonConvert.DeserializeObject>(responseHeaders); + } + catch { } + } + + return result; + } +} diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application/LINGYUN/Abp/WebhooksManagement/WebhooksManagementApplicationModule.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application/LINGYUN/Abp/WebhooksManagement/WebhooksManagementApplicationModule.cs index eef27929b..91f36366c 100644 --- a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application/LINGYUN/Abp/WebhooksManagement/WebhooksManagementApplicationModule.cs +++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application/LINGYUN/Abp/WebhooksManagement/WebhooksManagementApplicationModule.cs @@ -1,7 +1,6 @@ using Microsoft.Extensions.DependencyInjection; using Volo.Abp.Application; using Volo.Abp.Authorization; -using Volo.Abp.AutoMapper; using Volo.Abp.Modularity; namespace LINGYUN.Abp.WebhooksManagement; @@ -14,11 +13,6 @@ public class WebhooksManagementApplicationModule : 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/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN.Abp.WebhooksManagement.Domain.csproj b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN.Abp.WebhooksManagement.Domain.csproj index 129ad9f99..360aa6ff7 100644 --- a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN.Abp.WebhooksManagement.Domain.csproj +++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN.Abp.WebhooksManagement.Domain.csproj @@ -14,7 +14,7 @@ - + diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/WebhooksManagementDomainMapperProfile.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/WebhooksManagementDomainMapperProfile.cs deleted file mode 100644 index 231739e73..000000000 --- a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/WebhooksManagementDomainMapperProfile.cs +++ /dev/null @@ -1,20 +0,0 @@ -using AutoMapper; -using LINGYUN.Abp.Webhooks; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; - -namespace LINGYUN.Abp.WebhooksManagement; - -public class WebhooksManagementDomainMapperProfile : Profile -{ - public WebhooksManagementDomainMapperProfile() - { - CreateMap(); - CreateMap(); - CreateMap(); - - CreateMap(); - CreateMap(); - } -} diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/WebhooksManagementDomainMappers.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/WebhooksManagementDomainMappers.cs new file mode 100644 index 000000000..d3d86940c --- /dev/null +++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/WebhooksManagementDomainMappers.cs @@ -0,0 +1,40 @@ +using LINGYUN.Abp.Webhooks; +using Riok.Mapperly.Abstractions; +using Volo.Abp.Mapperly; + +namespace LINGYUN.Abp.WebhooksManagement; + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class WebhookEventRecordToWebhookEventEtoMapper : MapperBase +{ + public override partial WebhookEventEto Map(WebhookEventRecord source); + public override partial void Map(WebhookEventRecord source, WebhookEventEto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class WebhookSendRecordToWebhookSendAttemptEtoMapper : MapperBase +{ + public override partial WebhookSendAttemptEto Map(WebhookSendRecord source); + public override partial void Map(WebhookSendRecord source, WebhookSendAttemptEto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class WebhookSubscriptionToWebhookSubscriptionEtoMapper : MapperBase +{ + public override partial WebhookSubscriptionEto Map(WebhookSubscription source); + public override partial void Map(WebhookSubscription source, WebhookSubscriptionEto destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class WebhookEventRecordToWebhookEventMapper : MapperBase +{ + public override partial WebhookEvent Map(WebhookEventRecord source); + public override partial void Map(WebhookEventRecord source, WebhookEvent destination); +} + +[Mapper(RequiredMappingStrategy = RequiredMappingStrategy.Target)] +public partial class WebhookSendRecordToWebhookSendAttemptMapper : MapperBase +{ + public override partial WebhookSendAttempt Map(WebhookSendRecord source); + public override partial void Map(WebhookSendRecord source, WebhookSendAttempt destination); +} diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/WebhooksManagementDomainModule.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/WebhooksManagementDomainModule.cs index 58ccf42e2..25ec1a198 100644 --- a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/WebhooksManagementDomainModule.cs +++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/WebhooksManagementDomainModule.cs @@ -4,9 +4,9 @@ using Microsoft.Extensions.DependencyInjection; using System.Threading; using System.Threading.Tasks; using Volo.Abp; -using Volo.Abp.AutoMapper; using Volo.Abp.Data; using Volo.Abp.Domain.Entities.Events.Distributed; +using Volo.Abp.Mapperly; using Volo.Abp.Modularity; using Volo.Abp.ObjectExtending.Modularity; using Volo.Abp.Threading; @@ -14,7 +14,7 @@ using Volo.Abp.Threading; namespace LINGYUN.Abp.WebhooksManagement; [DependsOn( - typeof(AbpAutoMapperModule), + typeof(AbpMapperlyModule), typeof(AbpWebhooksModule), typeof(WebhooksManagementDomainSharedModule))] public class WebhooksManagementDomainModule : AbpModule @@ -24,12 +24,7 @@ public class WebhooksManagementDomainModule : AbpModule public override void ConfigureServices(ServiceConfigurationContext context) { - context.Services.AddAutoMapperObjectMapper(); - - Configure(options => - { - options.AddProfile(validate: true); - }); + context.Services.AddMapperlyObjectMapper(); Configure(options => {