From 27f726ac160e49165ced3a9b47e631146eefc94f Mon Sep 17 00:00:00 2001
From: cKey <35512826+colinin@users.noreply.github.com>
Date: Wed, 26 Aug 2020 16:07:32 +0800
Subject: [PATCH] Temporary fix for ABP framework entity-related events bug
---
aspnet-core/LINGYUN.MicroService.sln | 7 +
.../LINGYUN.Abp.Domain.Entities.Events.csproj | 12 ++
.../Events/AbpDddDomainEntitesEventsModule.cs | 10 ++
.../Entites/Events/EntityChangeEventHelper.cs | 151 ++++++++++++++++++
.../Distributed/TenantCreateEventHandler.cs | 11 +-
.../Distributed/TenantUpdateEventHandler.cs | 11 +-
.../Abp/MultiTenancy/DbFinder/TenantStore.cs | 11 +-
.../Abp/TenantManagement/TenantAppService.cs | 20 ++-
.../AuthIdentityServerModule.cs | 2 +
.../AuthServer.Host/AuthServer.Host.csproj | 1 +
.../BackendAdminHostModule.cs | 2 +
.../LINGYUN.BackendAdminApp.Host.csproj | 1 +
.../ApiGatewayHttpApiHostModule.cs | 2 +
.../LINGYUN.ApiGateway.HttpApi.Host.csproj | 1 +
...YUN.Abp.MessageService.HttpApi.Host.csproj | 1 +
.../AbpMessageServiceHttpApiHostModule.cs | 2 +
.../AppPlatformHttpApiHostModule.cs | 2 +
.../LINGYUN.Platform.HttpApi.Host.csproj | 1 +
18 files changed, 231 insertions(+), 17 deletions(-)
create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.Domain.Entities.Events/LINGYUN.Abp.Domain.Entities.Events.csproj
create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.Domain.Entities.Events/LINGYUN/Abp/Domain/Entites/Events/AbpDddDomainEntitesEventsModule.cs
create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.Domain.Entities.Events/LINGYUN/Abp/Domain/Entites/Events/EntityChangeEventHelper.cs
diff --git a/aspnet-core/LINGYUN.MicroService.sln b/aspnet-core/LINGYUN.MicroService.sln
index 94df85523..bf559bea3 100644
--- a/aspnet-core/LINGYUN.MicroService.sln
+++ b/aspnet-core/LINGYUN.MicroService.sln
@@ -213,6 +213,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Identity.Domain
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Identity.EntityFrameworkCore", "modules\identity\LINGYUN.Abp.Identity.EntityFrameworkCore\LINGYUN.Abp.Identity.EntityFrameworkCore.csproj", "{6FE7E243-2D99-4567-8786-6C9283D608EF}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Domain.Entities.Events", "modules\common\LINGYUN.Abp.Domain.Entities.Events\LINGYUN.Abp.Domain.Entities.Events.csproj", "{AAD8EF65-1FBF-4F3F-8B33-8B76E1EBA4A5}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -567,6 +569,10 @@ Global
{6FE7E243-2D99-4567-8786-6C9283D608EF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6FE7E243-2D99-4567-8786-6C9283D608EF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6FE7E243-2D99-4567-8786-6C9283D608EF}.Release|Any CPU.Build.0 = Release|Any CPU
+ {AAD8EF65-1FBF-4F3F-8B33-8B76E1EBA4A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {AAD8EF65-1FBF-4F3F-8B33-8B76E1EBA4A5}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {AAD8EF65-1FBF-4F3F-8B33-8B76E1EBA4A5}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {AAD8EF65-1FBF-4F3F-8B33-8B76E1EBA4A5}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -674,6 +680,7 @@ Global
{5D0ED1FC-3A7C-4531-9512-832E73AD9555} = {0439B173-F41E-4CE0-A44A-CCB70328F272}
{2BF7FB73-0C62-4ECF-99F0-0583855D2777} = {52B5D4F7-237B-4E0A-A167-68442164F70A}
{6FE7E243-2D99-4567-8786-6C9283D608EF} = {52B5D4F7-237B-4E0A-A167-68442164F70A}
+ {AAD8EF65-1FBF-4F3F-8B33-8B76E1EBA4A5} = {8AC72641-30D3-4ACF-89FA-808FADC55C2E}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C95FDF91-16F2-4A8B-A4BE-0E62D1B66718}
diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Domain.Entities.Events/LINGYUN.Abp.Domain.Entities.Events.csproj b/aspnet-core/modules/common/LINGYUN.Abp.Domain.Entities.Events/LINGYUN.Abp.Domain.Entities.Events.csproj
new file mode 100644
index 000000000..5949bdecb
--- /dev/null
+++ b/aspnet-core/modules/common/LINGYUN.Abp.Domain.Entities.Events/LINGYUN.Abp.Domain.Entities.Events.csproj
@@ -0,0 +1,12 @@
+
+
+
+ netstandard2.0
+
+
+
+
+
+
+
+
diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Domain.Entities.Events/LINGYUN/Abp/Domain/Entites/Events/AbpDddDomainEntitesEventsModule.cs b/aspnet-core/modules/common/LINGYUN.Abp.Domain.Entities.Events/LINGYUN/Abp/Domain/Entites/Events/AbpDddDomainEntitesEventsModule.cs
new file mode 100644
index 000000000..1e58ef752
--- /dev/null
+++ b/aspnet-core/modules/common/LINGYUN.Abp.Domain.Entities.Events/LINGYUN/Abp/Domain/Entites/Events/AbpDddDomainEntitesEventsModule.cs
@@ -0,0 +1,10 @@
+using Volo.Abp.Domain;
+using Volo.Abp.Modularity;
+
+namespace LINGYUN.Abp.Domain.Entities.Events
+{
+ [DependsOn(typeof(AbpDddDomainModule))]
+ public class AbpDddDomainEntitesEventsModule : AbpModule
+ {
+ }
+}
diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Domain.Entities.Events/LINGYUN/Abp/Domain/Entites/Events/EntityChangeEventHelper.cs b/aspnet-core/modules/common/LINGYUN.Abp.Domain.Entities.Events/LINGYUN/Abp/Domain/Entites/Events/EntityChangeEventHelper.cs
new file mode 100644
index 000000000..69d29eee0
--- /dev/null
+++ b/aspnet-core/modules/common/LINGYUN.Abp.Domain.Entities.Events/LINGYUN/Abp/Domain/Entites/Events/EntityChangeEventHelper.cs
@@ -0,0 +1,151 @@
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Volo.Abp.DependencyInjection;
+using Volo.Abp.Domain.Entities;
+using Volo.Abp.Domain.Entities.Events;
+using Volo.Abp.Domain.Entities.Events.Distributed;
+using Volo.Abp.DynamicProxy;
+using Volo.Abp.EventBus;
+using Volo.Abp.Uow;
+
+namespace LINGYUN.Abp.Domain.Entities.Events
+{
+ [Dependency(Microsoft.Extensions.DependencyInjection.ServiceLifetime.Transient, ReplaceServices = true)]
+ [ExposeServices(typeof(IEntityChangeEventHelper), typeof(Volo.Abp.Domain.Entities.Events.EntityChangeEventHelper))]
+ [Obsolete("the component will be removed when the abp framework is upgraded to 3.1.0")]
+ public class EntityChangeEventHelper : Volo.Abp.Domain.Entities.Events.EntityChangeEventHelper
+ {
+ public EntityChangeEventHelper(
+ IUnitOfWorkManager unitOfWorkManager,
+ IEntityToEtoMapper entityToEtoMapper,
+ IOptions distributedEntityEventOptions)
+ : base(unitOfWorkManager, entityToEtoMapper, distributedEntityEventOptions)
+ {
+ }
+
+ protected override async Task TriggerEventWithEntity(
+ IEventBus eventPublisher,
+ Type genericEventType,
+ object entityOrEto,
+ object originalEntity,
+ bool triggerInCurrentUnitOfWork)
+ {
+ var entityType = ProxyHelper.UnProxy(entityOrEto).GetType();
+ var eventType = genericEventType.MakeGenericType(entityType);
+ var currentUow = UnitOfWorkManager.Current;
+
+ if (triggerInCurrentUnitOfWork || currentUow == null)
+ {
+ await eventPublisher.PublishAsync(
+ eventType,
+ Activator.CreateInstance(eventType, entityOrEto)
+ );
+
+ return;
+ }
+
+ var eventList = GetEventList(currentUow);
+ var isFirstEvent = !eventList.Any();
+
+ eventList.AddUniqueEvent(eventPublisher, eventType, entityOrEto, originalEntity);
+
+ /* Register to OnCompleted if this is the first item.
+ * Other items will already be in the list once the UOW completes.
+ */
+ if (isFirstEvent)
+ {
+ currentUow.OnCompleted(
+ async () =>
+ {
+ foreach (var eventEntry in eventList)
+ {
+ try
+ {
+ // TODO: abp.io 3.1修复
+ await eventEntry.EventBus.PublishAsync(
+ eventEntry.EventType,
+ Activator.CreateInstance(eventEntry.EventType, eventEntry.EntityOrEto)
+ );
+ }
+ catch (Exception ex)
+ {
+ Logger.LogError(
+ $"Caught an exception while publishing the event '{eventType.FullName}' for the entity '{entityOrEto}'");
+ Logger.LogException(ex);
+ }
+ }
+ }
+ );
+ }
+ }
+
+ private EntityChangeEventList GetEventList(IUnitOfWork currentUow)
+ {
+ return (EntityChangeEventList)currentUow.Items.GetOrAdd(
+ "AbpEntityChangeEventList",
+ () => new EntityChangeEventList()
+ );
+ }
+
+ private class EntityChangeEventList : List
+ {
+ public void AddUniqueEvent(IEventBus eventBus, Type eventType, object entityOrEto, object originalEntity)
+ {
+ var newEntry = new EntityChangeEventEntry(eventBus, eventType, entityOrEto, originalEntity);
+
+ //Latest "same" event overrides the previous events.
+ for (var i = 0; i < Count; i++)
+ {
+ if (this[i].IsSameEvent(newEntry))
+ {
+ this[i] = newEntry;
+ return;
+ }
+ }
+
+ //If this is a "new" event, add to the end
+ Add(newEntry);
+ }
+ }
+
+ private class EntityChangeEventEntry
+ {
+ public IEventBus EventBus { get; }
+
+ public Type EventType { get; }
+
+ public object EntityOrEto { get; }
+
+ public object OriginalEntity { get; }
+
+ public EntityChangeEventEntry(IEventBus eventBus, Type eventType, object entityOrEto, object originalEntity)
+ {
+ EventType = eventType;
+ EntityOrEto = entityOrEto;
+ OriginalEntity = originalEntity;
+ EventBus = eventBus;
+ }
+
+ public bool IsSameEvent(EntityChangeEventEntry otherEntry)
+ {
+ if (EventBus != otherEntry.EventBus || EventType != otherEntry.EventType)
+ {
+ return false;
+ }
+
+ var originalEntityRef = OriginalEntity as IEntity;
+ var otherOriginalEntityRef = otherEntry.OriginalEntity as IEntity;
+ if (originalEntityRef == null || otherOriginalEntityRef == null)
+ {
+ return false;
+ }
+
+ return EntityHelper.EntityEquals(originalEntityRef, otherOriginalEntityRef);
+ }
+ }
+ }
+}
diff --git a/aspnet-core/modules/tenants/LINGYUN.Abp.MultiTenancy.DbFinder/LINGYUN/Abp/MultiTenancy/DbFinder/EventBus/Distributed/TenantCreateEventHandler.cs b/aspnet-core/modules/tenants/LINGYUN.Abp.MultiTenancy.DbFinder/LINGYUN/Abp/MultiTenancy/DbFinder/EventBus/Distributed/TenantCreateEventHandler.cs
index aeeeb16a6..c207ab918 100644
--- a/aspnet-core/modules/tenants/LINGYUN.Abp.MultiTenancy.DbFinder/LINGYUN/Abp/MultiTenancy/DbFinder/EventBus/Distributed/TenantCreateEventHandler.cs
+++ b/aspnet-core/modules/tenants/LINGYUN.Abp.MultiTenancy.DbFinder/LINGYUN/Abp/MultiTenancy/DbFinder/EventBus/Distributed/TenantCreateEventHandler.cs
@@ -6,29 +6,30 @@ using Volo.Abp.Domain.Entities.Events.Distributed;
using Volo.Abp.EventBus.Distributed;
using Volo.Abp.MultiTenancy;
using Volo.Abp.TenantManagement;
+using Volo.Abp.Uow;
namespace LINGYUN.Abp.MultiTenancy.DbFinder.EventBus.Distributed
{
public class TenantCreateEventHandler : IDistributedEventHandler>, ITransientDependency
{
- private readonly IDataFilter _dataFilter;
+ private readonly ICurrentTenant _currentTenant;
private readonly ITenantRepository _tenantRepository;
private readonly IDistributedCache _cache;
public TenantCreateEventHandler(
- IDataFilter dataFilter,
+ ICurrentTenant currentTenant,
ITenantRepository tenantRepository,
IDistributedCache cache)
{
_cache = cache;
- _dataFilter = dataFilter;
+ _currentTenant = currentTenant;
_tenantRepository = tenantRepository;
}
+ [UnitOfWork]
public virtual async Task HandleEventAsync(EntityCreatedEto eventData)
{
- // 禁用租户过滤器
- using (_dataFilter.Disable())
+ using (_currentTenant.Change(null))
{
var tenant = await _tenantRepository.FindAsync(eventData.Entity.Id, true);
if (tenant == null)
diff --git a/aspnet-core/modules/tenants/LINGYUN.Abp.MultiTenancy.DbFinder/LINGYUN/Abp/MultiTenancy/DbFinder/EventBus/Distributed/TenantUpdateEventHandler.cs b/aspnet-core/modules/tenants/LINGYUN.Abp.MultiTenancy.DbFinder/LINGYUN/Abp/MultiTenancy/DbFinder/EventBus/Distributed/TenantUpdateEventHandler.cs
index 2d0c597a2..4fe9dd599 100644
--- a/aspnet-core/modules/tenants/LINGYUN.Abp.MultiTenancy.DbFinder/LINGYUN/Abp/MultiTenancy/DbFinder/EventBus/Distributed/TenantUpdateEventHandler.cs
+++ b/aspnet-core/modules/tenants/LINGYUN.Abp.MultiTenancy.DbFinder/LINGYUN/Abp/MultiTenancy/DbFinder/EventBus/Distributed/TenantUpdateEventHandler.cs
@@ -6,29 +6,30 @@ using Volo.Abp.Domain.Entities.Events.Distributed;
using Volo.Abp.EventBus.Distributed;
using Volo.Abp.MultiTenancy;
using Volo.Abp.TenantManagement;
+using Volo.Abp.Uow;
namespace LINGYUN.Abp.MultiTenancy.DbFinder.EventBus.Distributed
{
public class TenantUpdateEventHandler : IDistributedEventHandler>, ITransientDependency
{
- private readonly IDataFilter _dataFilter;
+ private readonly ICurrentTenant _currentTenant;
private readonly ITenantRepository _tenantRepository;
private readonly IDistributedCache _cache;
public TenantUpdateEventHandler(
- IDataFilter dataFilter,
+ ICurrentTenant currentTenant,
ITenantRepository tenantRepository,
IDistributedCache cache)
{
_cache = cache;
- _dataFilter = dataFilter;
+ _currentTenant = currentTenant;
_tenantRepository = tenantRepository;
}
+ [UnitOfWork]
public virtual async Task HandleEventAsync(EntityUpdatedEto eventData)
{
- // 禁用租户过滤器
- using (_dataFilter.Disable())
+ using (_currentTenant.Change(null))
{
var tenant = await _tenantRepository.FindAsync(eventData.Entity.Id, true);
if (tenant == null)
diff --git a/aspnet-core/modules/tenants/LINGYUN.Abp.MultiTenancy.DbFinder/LINGYUN/Abp/MultiTenancy/DbFinder/TenantStore.cs b/aspnet-core/modules/tenants/LINGYUN.Abp.MultiTenancy.DbFinder/LINGYUN/Abp/MultiTenancy/DbFinder/TenantStore.cs
index b42114d7c..f3979f5f5 100644
--- a/aspnet-core/modules/tenants/LINGYUN.Abp.MultiTenancy.DbFinder/LINGYUN/Abp/MultiTenancy/DbFinder/TenantStore.cs
+++ b/aspnet-core/modules/tenants/LINGYUN.Abp.MultiTenancy.DbFinder/LINGYUN/Abp/MultiTenancy/DbFinder/TenantStore.cs
@@ -19,16 +19,16 @@ namespace LINGYUN.Abp.MultiTenancy.DbFinder
{
public ILogger Logger { protected get; set; }
private readonly IDistributedCache _cache;
- private readonly IDataFilter _dataFilter;
+ private readonly ICurrentTenant _currentTenant;
private readonly ITenantRepository _tenantRepository;
public TenantStore(
- IDataFilter dataFilter,
+ ICurrentTenant currentTenant,
ITenantRepository tenantRepository,
IDistributedCache cache)
{
_cache = cache;
- _dataFilter = dataFilter;
+ _currentTenant = currentTenant;
_tenantRepository = tenantRepository;
Logger = NullLogger.Instance;
@@ -91,8 +91,7 @@ namespace LINGYUN.Abp.MultiTenancy.DbFinder
}
Logger.LogDebug($"Not found in the cache, getting from the repository: {cacheKey}");
- // 禁用租户过滤器
- using (_dataFilter.Disable())
+ using (_currentTenant.Change(null))
{
var tenant = await _tenantRepository.FindAsync(id, true);
if (tenant == null)
@@ -129,7 +128,7 @@ namespace LINGYUN.Abp.MultiTenancy.DbFinder
}
Logger.LogDebug($"Not found in the cache, getting from the repository: {cacheKey}");
- using (_dataFilter.Disable())
+ using (_currentTenant.Change(null))
{
var tenant = await _tenantRepository.FindByNameAsync(name);
if (tenant == null)
diff --git a/aspnet-core/modules/tenants/LINGYUN.Abp.TenantManagement.Application/LINGYUN/Abp/TenantManagement/TenantAppService.cs b/aspnet-core/modules/tenants/LINGYUN.Abp.TenantManagement.Application/LINGYUN/Abp/TenantManagement/TenantAppService.cs
index 6c40eb4c7..9772d2bde 100644
--- a/aspnet-core/modules/tenants/LINGYUN.Abp.TenantManagement.Application/LINGYUN/Abp/TenantManagement/TenantAppService.cs
+++ b/aspnet-core/modules/tenants/LINGYUN.Abp.TenantManagement.Application/LINGYUN/Abp/TenantManagement/TenantAppService.cs
@@ -146,7 +146,16 @@ namespace LINGYUN.Abp.TenantManagement
{
var tenant = await TenantRepository.GetAsync(id);
tenant.SetConnectionString(tenantConnectionStringCreateOrUpdate.Name, tenantConnectionStringCreateOrUpdate.Value);
-
+ var updateEventData = new UpdateEventData
+ {
+ Id = tenant.Id,
+ OriginName = tenant.Name,
+ Name = tenant.Name
+ };
+ // abp当前版本(3.0.0)在EntityChangeEventHelper中存在一个问题,无法发送框架默认的Eto,预计3.1.0修复
+ // 发送自定义的事件数据来确保缓存被更新
+ await EventBus.PublishAsync(updateEventData);
+
return new TenantConnectionStringDto
{
Name = tenantConnectionStringCreateOrUpdate.Name,
@@ -160,6 +169,15 @@ namespace LINGYUN.Abp.TenantManagement
var tenant = await TenantRepository.GetAsync(tenantConnectionGetByName.Id);
tenant.RemoveConnectionString(tenantConnectionGetByName.Name);
+
+ var updateEventData = new UpdateEventData
+ {
+ Id = tenant.Id,
+ OriginName = tenant.Name,
+ Name = tenant.Name
+ };
+ await EventBus.PublishAsync(updateEventData);
+
await TenantRepository.UpdateAsync(tenant);
}
}
diff --git a/aspnet-core/services/account/AuthServer.Host/AuthIdentityServerModule.cs b/aspnet-core/services/account/AuthServer.Host/AuthIdentityServerModule.cs
index d8b642531..543961a9c 100644
--- a/aspnet-core/services/account/AuthServer.Host/AuthIdentityServerModule.cs
+++ b/aspnet-core/services/account/AuthServer.Host/AuthIdentityServerModule.cs
@@ -1,4 +1,5 @@
using DotNetCore.CAP;
+using LINGYUN.Abp.Domain.Entities.Events;
using LINGYUN.Abp.EventBus.CAP;
using LINGYUN.Abp.IdentityServer;
using LINGYUN.Abp.MultiTenancy.DbFinder;
@@ -43,6 +44,7 @@ namespace AuthServer.Host
typeof(AbpCAPEventBusModule),
typeof(AbpIdentityAspNetCoreModule),
typeof(AbpDbFinderMultiTenancyModule),
+ typeof(AbpDddDomainEntitesEventsModule),
typeof(AbpCachingStackExchangeRedisModule),
typeof(AbpIdentityServerSmsValidatorModule),
typeof(AbpIdentityServerWeChatValidatorModule),
diff --git a/aspnet-core/services/account/AuthServer.Host/AuthServer.Host.csproj b/aspnet-core/services/account/AuthServer.Host/AuthServer.Host.csproj
index 9cfbdb94d..8b53e7a06 100644
--- a/aspnet-core/services/account/AuthServer.Host/AuthServer.Host.csproj
+++ b/aspnet-core/services/account/AuthServer.Host/AuthServer.Host.csproj
@@ -33,6 +33,7 @@
+
diff --git a/aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/BackendAdminHostModule.cs b/aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/BackendAdminHostModule.cs
index 94c4d68ea..99abb0a3b 100644
--- a/aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/BackendAdminHostModule.cs
+++ b/aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/BackendAdminHostModule.cs
@@ -1,5 +1,6 @@
using DotNetCore.CAP;
using IdentityModel;
+using LINGYUN.Abp.Domain.Entities.Events;
using LINGYUN.Abp.EventBus.CAP;
using LINGYUN.Abp.ExceptionHandling;
using LINGYUN.Abp.ExceptionHandling.Emailing;
@@ -91,6 +92,7 @@ namespace LINGYUN.BackendAdmin
typeof(AbpTencentLocationModule),
typeof(AbpDbFinderMultiTenancyModule),
typeof(AbpCachingStackExchangeRedisModule),
+ typeof(AbpDddDomainEntitesEventsModule),
typeof(AbpAutofacModule)
)]
public class BackendAdminHostModule : AbpModule
diff --git a/aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/LINGYUN.BackendAdminApp.Host.csproj b/aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/LINGYUN.BackendAdminApp.Host.csproj
index 33e5d37b9..cda240fd0 100644
--- a/aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/LINGYUN.BackendAdminApp.Host.csproj
+++ b/aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/LINGYUN.BackendAdminApp.Host.csproj
@@ -60,6 +60,7 @@
+
diff --git a/aspnet-core/services/apigateway/LINGYUN.ApiGateway.HttpApi.Host/ApiGatewayHttpApiHostModule.cs b/aspnet-core/services/apigateway/LINGYUN.ApiGateway.HttpApi.Host/ApiGatewayHttpApiHostModule.cs
index 5aff1fcda..991272cb8 100644
--- a/aspnet-core/services/apigateway/LINGYUN.ApiGateway.HttpApi.Host/ApiGatewayHttpApiHostModule.cs
+++ b/aspnet-core/services/apigateway/LINGYUN.ApiGateway.HttpApi.Host/ApiGatewayHttpApiHostModule.cs
@@ -1,6 +1,7 @@
using DotNetCore.CAP;
using DotNetCore.CAP.Messages;
using IdentityModel;
+using LINGYUN.Abp.Domain.Entities.Events;
using LINGYUN.Abp.EventBus.CAP;
using LINGYUN.Abp.MultiTenancy.DbFinder;
using LINGYUN.ApiGateway.EntityFrameworkCore;
@@ -48,6 +49,7 @@ namespace LINGYUN.ApiGateway
typeof(AbpCAPEventBusModule),
typeof(AbpDbFinderMultiTenancyModule),
typeof(AbpCachingStackExchangeRedisModule),
+ typeof(AbpDddDomainEntitesEventsModule),
typeof(AbpAutofacModule)
)]
public class ApiGatewayHttpApiHostModule : AbpModule
diff --git a/aspnet-core/services/apigateway/LINGYUN.ApiGateway.HttpApi.Host/LINGYUN.ApiGateway.HttpApi.Host.csproj b/aspnet-core/services/apigateway/LINGYUN.ApiGateway.HttpApi.Host/LINGYUN.ApiGateway.HttpApi.Host.csproj
index d3c2fdab6..e7b4803ec 100644
--- a/aspnet-core/services/apigateway/LINGYUN.ApiGateway.HttpApi.Host/LINGYUN.ApiGateway.HttpApi.Host.csproj
+++ b/aspnet-core/services/apigateway/LINGYUN.ApiGateway.HttpApi.Host/LINGYUN.ApiGateway.HttpApi.Host.csproj
@@ -39,6 +39,7 @@
+
diff --git a/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/LINGYUN.Abp.MessageService.HttpApi.Host.csproj b/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/LINGYUN.Abp.MessageService.HttpApi.Host.csproj
index 11e704e81..7f323bee6 100644
--- a/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/LINGYUN.Abp.MessageService.HttpApi.Host.csproj
+++ b/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/LINGYUN.Abp.MessageService.HttpApi.Host.csproj
@@ -43,6 +43,7 @@
+
diff --git a/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/LINGYUN/Abp/MessageService/AbpMessageServiceHttpApiHostModule.cs b/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/LINGYUN/Abp/MessageService/AbpMessageServiceHttpApiHostModule.cs
index 4e23539e7..4b7729474 100644
--- a/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/LINGYUN/Abp/MessageService/AbpMessageServiceHttpApiHostModule.cs
+++ b/aspnet-core/services/messages/LINGYUN.Abp.MessageService.HttpApi.Host/LINGYUN/Abp/MessageService/AbpMessageServiceHttpApiHostModule.cs
@@ -2,6 +2,7 @@
using Hangfire;
using IdentityModel;
using LINGYUN.Abp.BackgroundJobs.Hangfire;
+using LINGYUN.Abp.Domain.Entities.Events;
using LINGYUN.Abp.EventBus.CAP;
using LINGYUN.Abp.ExceptionHandling;
using LINGYUN.Abp.ExceptionHandling.Notifications;
@@ -61,6 +62,7 @@ namespace LINGYUN.Abp.MessageService
typeof(AbpHangfireMySqlStorageModule),
typeof(AbpDbFinderMultiTenancyModule),
typeof(AbpCachingStackExchangeRedisModule),
+ typeof(AbpDddDomainEntitesEventsModule),
typeof(AbpAutofacModule)
)]
public class AbpMessageServiceHttpApiHostModule : AbpModule
diff --git a/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/AppPlatformHttpApiHostModule.cs b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/AppPlatformHttpApiHostModule.cs
index cf2bf4347..1a23b6508 100644
--- a/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/AppPlatformHttpApiHostModule.cs
+++ b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/AppPlatformHttpApiHostModule.cs
@@ -1,5 +1,6 @@
using DotNetCore.CAP;
using IdentityModel;
+using LINGYUN.Abp.Domain.Entities.Events;
using LINGYUN.Abp.EventBus.CAP;
using LINGYUN.Abp.ExceptionHandling;
using LINGYUN.Abp.ExceptionHandling.Emailing;
@@ -60,6 +61,7 @@ namespace LINGYUN.Platform
typeof(AbpBlobStoringFileSystemModule),
typeof(AbpDbFinderMultiTenancyModule),
typeof(AbpCachingStackExchangeRedisModule),
+ typeof(AbpDddDomainEntitesEventsModule),
typeof(AbpAutofacModule)
)]
public class AppPlatformHttpApiHostModule : AbpModule
diff --git a/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/LINGYUN.Platform.HttpApi.Host.csproj b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/LINGYUN.Platform.HttpApi.Host.csproj
index f5881c6cd..00aa72acf 100644
--- a/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/LINGYUN.Platform.HttpApi.Host.csproj
+++ b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/LINGYUN.Platform.HttpApi.Host.csproj
@@ -46,6 +46,7 @@
+