diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/AbpDistributedEntityEventOptions.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/AbpDistributedEntityEventOptions.cs new file mode 100644 index 0000000000..19652fca8e --- /dev/null +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/AbpDistributedEntityEventOptions.cs @@ -0,0 +1,15 @@ +namespace Volo.Abp.Domain.Entities.Events.Distributed +{ + public class AbpDistributedEntityEventOptions + { + public IAutoEntityDistributedEventSelectorList AutoEventSelectors { get; } + + public EtoMappingDictionary EtoMappings { get; set; } + + public AbpDistributedEntityEventOptions() + { + AutoEventSelectors = new AutoEntityDistributedEventSelectorList(); + EtoMappings = new EtoMappingDictionary(); + } + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/AutoEntityDistributedEventSelectorList.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/AutoEntityDistributedEventSelectorList.cs new file mode 100644 index 0000000000..f705f892d5 --- /dev/null +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/AutoEntityDistributedEventSelectorList.cs @@ -0,0 +1,12 @@ +using System.Collections.Generic; + +namespace Volo.Abp.Domain.Entities.Events.Distributed +{ + public class AutoEntityDistributedEventSelectorList : List, IAutoEntityDistributedEventSelectorList + { + public bool RemoveByName(string name) + { + return RemoveAll(s => s.Name == name) > 0; + } + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/AutoEntityDistributedEventSelectorListExtensions.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/AutoEntityDistributedEventSelectorListExtensions.cs new file mode 100644 index 0000000000..e078dfaf43 --- /dev/null +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/AutoEntityDistributedEventSelectorListExtensions.cs @@ -0,0 +1,78 @@ +using System; +using System.Linq; +using JetBrains.Annotations; + +namespace Volo.Abp.Domain.Entities.Events.Distributed +{ + public static class AutoEntityDistributedEventSelectorListExtensions + { + public const string AllEntitiesSelectorName = "All"; + + public static void AddNamespace([NotNull] this IAutoEntityDistributedEventSelectorList selectors, [NotNull] string namespaceName) + { + Check.NotNull(selectors, nameof(selectors)); + + var selectorName = "Namespace:" + namespaceName; + if (selectors.Any(s => s.Name == selectorName)) + { + return; + } + + selectors.Add( + new NamedTypeSelector( + selectorName, + t => t.FullName?.StartsWith(namespaceName) ?? false + ) + ); + } + + /// + /// Adds a specific entity type and the types derived from that entity type. + /// + /// Type of the entity + public static void Add([NotNull] this IAutoEntityDistributedEventSelectorList selectors) + where TEntity : IEntity + { + Check.NotNull(selectors, nameof(selectors)); + + var selectorName = "Entity:" + typeof(TEntity).FullName; + if (selectors.Any(s => s.Name == selectorName)) + { + return; + } + + selectors.Add( + new NamedTypeSelector( + selectorName, + t => typeof(TEntity).IsAssignableFrom(t) + ) + ); + } + + /// + /// Adds all entity types. + /// + public static void AddAll([NotNull] this IAutoEntityDistributedEventSelectorList selectors) + { + Check.NotNull(selectors, nameof(selectors)); + + if (selectors.Any(s => s.Name == AllEntitiesSelectorName)) + { + return; + } + + selectors.Add( + new NamedTypeSelector( + AllEntitiesSelectorName, + t => typeof(IEntity).IsAssignableFrom(t) + ) + ); + } + + public static bool IsMatch([NotNull] this IAutoEntityDistributedEventSelectorList selectors, Type entityType) + { + Check.NotNull(selectors, nameof(selectors)); + return selectors.Any(s => s.Predicate(entityType)); + } + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/EntityToEtoMapper.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/EntityToEtoMapper.cs index 24a757fb08..15a41bad9d 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/EntityToEtoMapper.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/EntityToEtoMapper.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using Microsoft.Extensions.DependencyInjection; using Volo.Abp.DependencyInjection; using Volo.Abp.DynamicProxy; -using Volo.Abp.EventBus.Distributed; using Volo.Abp.ObjectMapping; namespace Volo.Abp.Domain.Entities.Events.Distributed @@ -11,10 +10,11 @@ namespace Volo.Abp.Domain.Entities.Events.Distributed public class EntityToEtoMapper : IEntityToEtoMapper, ITransientDependency { protected IHybridServiceScopeFactory HybridServiceScopeFactory { get; } - protected AbpDistributedEventBusOptions Options { get; } + + protected AbpDistributedEntityEventOptions Options { get; } public EntityToEtoMapper( - IOptions options, + IOptions options, IHybridServiceScopeFactory hybridServiceScopeFactory) { HybridServiceScopeFactory = hybridServiceScopeFactory; diff --git a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/EtoMappingDictionary.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/EtoMappingDictionary.cs similarity index 79% rename from framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/EtoMappingDictionary.cs rename to framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/EtoMappingDictionary.cs index aae99d0cb7..3988ceb3b5 100644 --- a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/EtoMappingDictionary.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/EtoMappingDictionary.cs @@ -1,7 +1,8 @@ using System; using System.Collections.Generic; +using Volo.Abp.EventBus.Distributed; -namespace Volo.Abp.EventBus.Distributed +namespace Volo.Abp.Domain.Entities.Events.Distributed { public class EtoMappingDictionary : Dictionary { diff --git a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/EtoMappingDictionaryItem.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/EtoMappingDictionaryItem.cs similarity index 87% rename from framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/EtoMappingDictionaryItem.cs rename to framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/EtoMappingDictionaryItem.cs index d634c44b4d..2550c83a53 100644 --- a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/EtoMappingDictionaryItem.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/EtoMappingDictionaryItem.cs @@ -1,6 +1,6 @@ using System; -namespace Volo.Abp.EventBus.Distributed +namespace Volo.Abp.Domain.Entities.Events.Distributed { public class EtoMappingDictionaryItem { diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/IAutoEntityDistributedEventSelectorList.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/IAutoEntityDistributedEventSelectorList.cs new file mode 100644 index 0000000000..589942e60e --- /dev/null +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/Distributed/IAutoEntityDistributedEventSelectorList.cs @@ -0,0 +1,9 @@ +using System.Collections.Generic; + +namespace Volo.Abp.Domain.Entities.Events.Distributed +{ + public interface IAutoEntityDistributedEventSelectorList : IList + { + bool RemoveByName(string name); + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/EntityChangeEventHelper.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/EntityChangeEventHelper.cs index 5d191b33e6..cad12b1450 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/EntityChangeEventHelper.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/EntityChangeEventHelper.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using Microsoft.Extensions.Options; using Volo.Abp.Auditing; using Volo.Abp.DependencyInjection; using Volo.Abp.Domain.Entities.Events.Distributed; @@ -22,13 +23,16 @@ namespace Volo.Abp.Domain.Entities.Events protected IUnitOfWorkManager UnitOfWorkManager { get; } protected IEntityToEtoMapper EntityToEtoMapper { get; } + protected AbpDistributedEntityEventOptions DistributedEntityEventOptions { get; } public EntityChangeEventHelper( IUnitOfWorkManager unitOfWorkManager, - IEntityToEtoMapper entityToEtoMapper) + IEntityToEtoMapper entityToEtoMapper, + IOptions distributedEntityEventOptions) { UnitOfWorkManager = unitOfWorkManager; EntityToEtoMapper = entityToEtoMapper; + DistributedEntityEventOptions = distributedEntityEventOptions.Value; LocalEventBus = NullLocalEventBus.Instance; DistributedEventBus = NullDistributedEventBus.Instance; @@ -65,18 +69,32 @@ namespace Volo.Abp.Domain.Entities.Events false ); - var eto = EntityToEtoMapper.Map(entity); - if (eto != null) + if (ShouldPublishDistributedEventForEntity(entity)) { - await TriggerEventWithEntity( - DistributedEventBus, - typeof(EntityCreatedEto<>), - eto, - false - ); + var eto = EntityToEtoMapper.Map(entity); + if (eto != null) + { + await TriggerEventWithEntity( + DistributedEventBus, + typeof(EntityCreatedEto<>), + eto, + false + ); + } } } + private bool ShouldPublishDistributedEventForEntity(object entity) + { + return DistributedEntityEventOptions + .AutoEventSelectors + .IsMatch( + ProxyHelper + .UnProxy(entity) + .GetType() + ); + } + public virtual async Task TriggerEntityUpdatingEventAsync(object entity) { await TriggerEventWithEntity( @@ -96,15 +114,18 @@ namespace Volo.Abp.Domain.Entities.Events false ); - var eto = EntityToEtoMapper.Map(entity); - if (eto != null) + if (ShouldPublishDistributedEventForEntity(entity)) { - await TriggerEventWithEntity( - DistributedEventBus, - typeof(EntityUpdatedEto<>), - eto, - false - ); + var eto = EntityToEtoMapper.Map(entity); + if (eto != null) + { + await TriggerEventWithEntity( + DistributedEventBus, + typeof(EntityUpdatedEto<>), + eto, + false + ); + } } } @@ -127,15 +148,18 @@ namespace Volo.Abp.Domain.Entities.Events false ); - var eto = EntityToEtoMapper.Map(entity); - if (eto != null) + if (ShouldPublishDistributedEventForEntity(entity)) { - await TriggerEventWithEntity( - DistributedEventBus, - typeof(EntityDeletedEto<>), - eto, - false - ); + var eto = EntityToEtoMapper.Map(entity); + if (eto != null) + { + await TriggerEventWithEntity( + DistributedEventBus, + typeof(EntityDeletedEto<>), + eto, + false + ); + } } } diff --git a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/AbpDistributedEventBusOptions.cs b/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/AbpDistributedEventBusOptions.cs index 1d1d7768f2..342e7b77bb 100644 --- a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/AbpDistributedEventBusOptions.cs +++ b/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Distributed/AbpDistributedEventBusOptions.cs @@ -5,12 +5,10 @@ namespace Volo.Abp.EventBus.Distributed public class AbpDistributedEventBusOptions { public ITypeList Handlers { get; } - public EtoMappingDictionary EtoMappings { get; set; } public AbpDistributedEventBusOptions() { Handlers = new TypeList(); - EtoMappings = new EtoMappingDictionary(); } } } \ No newline at end of file diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/TestAppModule.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/TestAppModule.cs index 683c99d417..41079bfa9e 100644 --- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/TestAppModule.cs +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/TestAppModule.cs @@ -4,7 +4,7 @@ using Volo.Abp.Autofac; using Volo.Abp.Modularity; using Volo.Abp.TestApp.Domain; using Volo.Abp.AutoMapper; -using Volo.Abp.EventBus.Distributed; +using Volo.Abp.Domain.Entities.Events.Distributed; using Volo.Abp.TestApp.Application.Dto; using Volo.Abp.Threading; @@ -45,8 +45,9 @@ namespace Volo.Abp.TestApp private void ConfigureDistributedEventBus() { - Configure(options => + Configure(options => { + options.AutoEventSelectors.Add(); options.EtoMappings.Add(); }); } diff --git a/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/BloggingDomainModule.cs b/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/BloggingDomainModule.cs index f39c4c88fb..3179303215 100644 --- a/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/BloggingDomainModule.cs +++ b/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/BloggingDomainModule.cs @@ -1,7 +1,7 @@ using Microsoft.Extensions.DependencyInjection; using Volo.Abp.AutoMapper; using Volo.Abp.Domain; -using Volo.Abp.EventBus.Distributed; +using Volo.Abp.Domain.Entities.Events.Distributed; using Volo.Abp.Modularity; using Volo.Blogging.Blogs; using Volo.Blogging.Comments; @@ -25,7 +25,7 @@ namespace Volo.Blogging options.AddProfile(validate: true); }); - Configure(options => + Configure(options => { options.EtoMappings.Add(typeof(BloggingDomainModule)); options.EtoMappings.Add(typeof(BloggingDomainModule)); diff --git a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/DocsDomainModule.cs b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/DocsDomainModule.cs index 5e53b858ce..ecc52d1f26 100644 --- a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/DocsDomainModule.cs +++ b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/DocsDomainModule.cs @@ -4,7 +4,7 @@ using Microsoft.Extensions.Options; using Volo.Abp; using Volo.Abp.AutoMapper; using Volo.Abp.Domain; -using Volo.Abp.EventBus.Distributed; +using Volo.Abp.Domain.Entities.Events.Distributed; using Volo.Abp.Localization; using Volo.Abp.Modularity; using Volo.Abp.Threading; @@ -34,7 +34,7 @@ namespace Volo.Docs options.AddProfile(validate: true); }); - Configure(options => + Configure(options => { options.EtoMappings.Add(typeof(DocsDomainModule)); options.EtoMappings.Add(typeof(DocsDomainModule)); diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityDomainModule.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityDomainModule.cs index f757c56f1e..07c4d2e971 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityDomainModule.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityDomainModule.cs @@ -4,7 +4,7 @@ using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Options; using Volo.Abp.AutoMapper; using Volo.Abp.Domain; -using Volo.Abp.EventBus.Distributed; +using Volo.Abp.Domain.Entities.Events.Distributed; using Volo.Abp.Modularity; using Volo.Abp.ObjectExtending; using Volo.Abp.ObjectExtending.Modularity; @@ -29,7 +29,7 @@ namespace Volo.Abp.Identity options.AddProfile(validate: true); }); - Configure(options => + Configure(options => { options.EtoMappings.Add(typeof(AbpIdentityDomainModule)); options.EtoMappings.Add(typeof(AbpIdentityDomainModule)); diff --git a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/AbpIdentityDomainTestModule.cs b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/AbpIdentityDomainTestModule.cs index d9fb330a02..ccfbb85359 100644 --- a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/AbpIdentityDomainTestModule.cs +++ b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/AbpIdentityDomainTestModule.cs @@ -1,5 +1,6 @@ using Microsoft.Extensions.DependencyInjection; using Volo.Abp.Authorization.Permissions; +using Volo.Abp.Domain.Entities.Events.Distributed; using Volo.Abp.Identity.EntityFrameworkCore; using Volo.Abp.Modularity; using Volo.Abp.PermissionManagement.Identity; @@ -14,6 +15,14 @@ namespace Volo.Abp.Identity )] public class AbpIdentityDomainTestModule : AbpModule { + public override void ConfigureServices(ServiceConfigurationContext context) + { + Configure(options => + { + options.AutoEventSelectors.Add(); + }); + } + public override void OnApplicationInitialization(ApplicationInitializationContext context) { SeedTestData(context); diff --git a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/Distributed_User_Change_Event_Tests.cs b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/Distributed_User_Change_Event_Tests.cs index 95e8f925c4..b3fc9b1ba3 100644 --- a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/Distributed_User_Change_Event_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/Distributed_User_Change_Event_Tests.cs @@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Identity; using Microsoft.Extensions.Options; using Shouldly; +using Volo.Abp.Domain.Entities.Events.Distributed; using Volo.Abp.EventBus.Distributed; using Volo.Abp.Testing.Utils; using Volo.Abp.Uow; @@ -28,11 +29,17 @@ namespace Volo.Abp.Identity } [Fact] - public async Task Should_Register_Handler() + public void Should_Register_Handler() { - var options = GetRequiredService>().Value; - options.EtoMappings.ShouldContain(m => m.Key == typeof(IdentityUser) && m.Value.EtoType == typeof(UserEto)); - options.Handlers.ShouldContain(h => h == typeof(DistributedUserUpdateHandler)); + GetRequiredService>() + .Value + .EtoMappings + .ShouldContain(m => m.Key == typeof(IdentityUser) && m.Value.EtoType == typeof(UserEto)); + + GetRequiredService>() + .Value + .Handlers + .ShouldContain(h => h == typeof(DistributedUserUpdateHandler)); } [Fact] diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDomainModule.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDomainModule.cs index 01001aeb35..9e36576e56 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDomainModule.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDomainModule.cs @@ -6,7 +6,7 @@ using Microsoft.Extensions.Options; using Volo.Abp.AutoMapper; using Volo.Abp.BackgroundWorkers; using Volo.Abp.Caching; -using Volo.Abp.EventBus.Distributed; +using Volo.Abp.Domain.Entities.Events.Distributed; using Volo.Abp.Identity; using Volo.Abp.IdentityServer.ApiResources; using Volo.Abp.IdentityServer.Clients; @@ -41,7 +41,7 @@ namespace Volo.Abp.IdentityServer options.AddProfile(validate: true); }); - Configure(options => + Configure(options => { options.EtoMappings.Add(typeof(AbpIdentityServerDomainModule)); options.EtoMappings.Add(typeof(AbpIdentityServerDomainModule)); diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/AbpTenantManagementDomainModule.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/AbpTenantManagementDomainModule.cs index f882f8659e..5bf2aeb0b9 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/AbpTenantManagementDomainModule.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/AbpTenantManagementDomainModule.cs @@ -2,7 +2,7 @@ using Volo.Abp.AutoMapper; using Volo.Abp.Data; using Volo.Abp.Domain; -using Volo.Abp.EventBus.Distributed; +using Volo.Abp.Domain.Entities.Events.Distributed; using Volo.Abp.Modularity; using Volo.Abp.MultiTenancy; using Volo.Abp.UI; @@ -26,7 +26,7 @@ namespace Volo.Abp.TenantManagement options.AddProfile(validate: true); }); - Configure(options => + Configure(options => { options.EtoMappings.Add(); }); diff --git a/samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminAppHostModule.cs b/samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminAppHostModule.cs index b351a33fb6..a8c5d58ac4 100644 --- a/samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminAppHostModule.cs +++ b/samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminAppHostModule.cs @@ -8,7 +8,6 @@ using ProductManagement; using StackExchange.Redis; using Microsoft.OpenApi.Models; using MsDemo.Shared; -using Swashbuckle.AspNetCore.Swagger; using Volo.Abp; using Volo.Abp.AspNetCore.Authentication.OAuth; using Volo.Abp.AspNetCore.Mvc.Client; diff --git a/samples/MicroserviceDemo/microservices/IdentityService.Host/IdentityServiceHostModule.cs b/samples/MicroserviceDemo/microservices/IdentityService.Host/IdentityServiceHostModule.cs index 9b96532e4c..83317c3f0f 100644 --- a/samples/MicroserviceDemo/microservices/IdentityService.Host/IdentityServiceHostModule.cs +++ b/samples/MicroserviceDemo/microservices/IdentityService.Host/IdentityServiceHostModule.cs @@ -13,6 +13,7 @@ using Volo.Abp.AspNetCore.Mvc; using Volo.Abp.Auditing; using Volo.Abp.AuditLogging.EntityFrameworkCore; using Volo.Abp.Autofac; +using Volo.Abp.Domain.Entities.Events.Distributed; using Volo.Abp.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore.SqlServer; using Volo.Abp.EventBus.RabbitMq; @@ -77,6 +78,11 @@ namespace IdentityService.Host { options.UseSqlServer(); }); + + Configure(options => + { + options.AutoEventSelectors.Add(); + }); context.Services.AddStackExchangeRedisCache(options => {