diff --git a/framework/src/Volo.Abp.Mapperly/Volo/Abp/Mapperly/AbpMapperlyModule.cs b/framework/src/Volo.Abp.Mapperly/Volo/Abp/Mapperly/AbpMapperlyModule.cs index 60381163eb..87cf270cee 100644 --- a/framework/src/Volo.Abp.Mapperly/Volo/Abp/Mapperly/AbpMapperlyModule.cs +++ b/framework/src/Volo.Abp.Mapperly/Volo/Abp/Mapperly/AbpMapperlyModule.cs @@ -1,4 +1,5 @@ -using Microsoft.Extensions.DependencyInjection; +using System.Linq; +using Microsoft.Extensions.DependencyInjection; using Volo.Abp.Auditing; using Volo.Abp.Modularity; using Volo.Abp.ObjectExtending; @@ -20,6 +21,11 @@ public class AbpMapperlyModule : AbpModule public override void ConfigureServices(ServiceConfigurationContext context) { - context.Services.AddMapperlyObjectMapper(); + // This is the temporary solution, We will remove it in when all apps are migrated to Mapperly. + var autoMapperModule = context.Services.FirstOrDefault(x => x.ServiceType.FullName == "Volo.Abp.AutoMapper.AbpAutoMapperModule"); + if (autoMapperModule == null) + { + context.Services.AddMapperlyObjectMapper(); + } } }