From 0b95234ccd9573e836059b84a78c514e05693608 Mon Sep 17 00:00:00 2001 From: maliming Date: Mon, 28 Oct 2019 18:11:11 +0800 Subject: [PATCH 01/11] Upgrade Ocelot to support net core 3.0 Resolve #1764 --- .../BackendAdminAppGateway.Host.csproj | 2 +- .../gateways/InternalGateway.Host/InternalGateway.Host.csproj | 2 +- .../PublicWebSiteGateway.Host/PublicWebSiteGateway.Host.csproj | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/BackendAdminAppGateway.Host.csproj b/samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/BackendAdminAppGateway.Host.csproj index 35f2d6318b..3a944bec65 100644 --- a/samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/BackendAdminAppGateway.Host.csproj +++ b/samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/BackendAdminAppGateway.Host.csproj @@ -16,7 +16,7 @@ - + diff --git a/samples/MicroserviceDemo/gateways/InternalGateway.Host/InternalGateway.Host.csproj b/samples/MicroserviceDemo/gateways/InternalGateway.Host/InternalGateway.Host.csproj index ea060feff3..4ce9e7f630 100644 --- a/samples/MicroserviceDemo/gateways/InternalGateway.Host/InternalGateway.Host.csproj +++ b/samples/MicroserviceDemo/gateways/InternalGateway.Host/InternalGateway.Host.csproj @@ -16,7 +16,7 @@ - + diff --git a/samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/PublicWebSiteGateway.Host.csproj b/samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/PublicWebSiteGateway.Host.csproj index d27c3bfbeb..313fda2630 100644 --- a/samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/PublicWebSiteGateway.Host.csproj +++ b/samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/PublicWebSiteGateway.Host.csproj @@ -16,7 +16,7 @@ - + From 5ba8367b17cc555a69822271df84cba16013a0d0 Mon Sep 17 00:00:00 2001 From: maliming Date: Tue, 29 Oct 2019 10:22:44 +0800 Subject: [PATCH 02/11] Calling UseRouting before UseMvcWithDefaultRouteAndArea. Resolve #2028 --- .../BackendAdminAppGatewayHostModule.cs | 6 +++++- .../InternalGateway.Host/InternalGatewayHostModule.cs | 6 +++++- .../PublicWebSiteGatewayHostModule.cs | 6 +++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/BackendAdminAppGatewayHostModule.cs b/samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/BackendAdminAppGatewayHostModule.cs index 45fe70e03f..d30dc8e4fb 100644 --- a/samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/BackendAdminAppGatewayHostModule.cs +++ b/samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/BackendAdminAppGatewayHostModule.cs @@ -103,7 +103,11 @@ namespace BackendAdminAppGateway.Host app.MapWhen( ctx => ctx.Request.Path.ToString().StartsWith("/api/abp/") || ctx.Request.Path.ToString().StartsWith("/Abp/"), - app2 => { app2.UseMvcWithDefaultRouteAndArea(); } + app2 => + { + app2.UseRouting(); + app2.UseMvcWithDefaultRouteAndArea(); + } ); app.UseOcelot().Wait(); diff --git a/samples/MicroserviceDemo/gateways/InternalGateway.Host/InternalGatewayHostModule.cs b/samples/MicroserviceDemo/gateways/InternalGateway.Host/InternalGatewayHostModule.cs index 1232852126..8b470f826f 100644 --- a/samples/MicroserviceDemo/gateways/InternalGateway.Host/InternalGatewayHostModule.cs +++ b/samples/MicroserviceDemo/gateways/InternalGateway.Host/InternalGatewayHostModule.cs @@ -94,7 +94,11 @@ namespace InternalGateway.Host ctx.Request.Path.ToString().StartsWith("/api/abp/") || ctx.Request.Path.ToString().StartsWith("/Abp/") || ctx.Request.Path.ToString().StartsWith("/Test/"), - app2 => { app2.UseMvcWithDefaultRouteAndArea(); } + app2 => + { + app2.UseRouting(); + app2.UseMvcWithDefaultRouteAndArea(); + } ); app.UseOcelot().Wait(); diff --git a/samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/PublicWebSiteGatewayHostModule.cs b/samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/PublicWebSiteGatewayHostModule.cs index 2513c16c00..2add48443a 100644 --- a/samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/PublicWebSiteGatewayHostModule.cs +++ b/samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/PublicWebSiteGatewayHostModule.cs @@ -90,7 +90,11 @@ namespace PublicWebSiteGateway.Host app.MapWhen( ctx => ctx.Request.Path.ToString().StartsWith("/api/abp/") || ctx.Request.Path.ToString().StartsWith("/Abp/"), - app2 => { app2.UseMvcWithDefaultRouteAndArea(); } + app2 => + { + app2.UseRouting(); + app2.UseMvcWithDefaultRouteAndArea(); + } ); app.UseOcelot().Wait(); From 0ffbb514497f85ac7a6d8855544a6d0fd0dbface Mon Sep 17 00:00:00 2001 From: maliming Date: Tue, 29 Oct 2019 13:11:42 +0800 Subject: [PATCH 03/11] Use ExpireTimeSpan instead of Cookie.Expiration. --- .../BackendAdminApp.Host/BackendAdminAppHostModule.cs | 1 - .../applications/PublicWebSite.Host/PublicWebSiteHostModule.cs | 1 - 2 files changed, 2 deletions(-) diff --git a/samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminAppHostModule.cs b/samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminAppHostModule.cs index 13c4577cc0..cd7cd24231 100644 --- a/samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminAppHostModule.cs +++ b/samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminAppHostModule.cs @@ -54,7 +54,6 @@ namespace BackendAdminApp.Host }) .AddCookie("Cookies", options => { - options.Cookie.Expiration = TimeSpan.FromDays(365); options.ExpireTimeSpan = TimeSpan.FromDays(365); }) .AddOpenIdConnect("oidc", options => diff --git a/samples/MicroserviceDemo/applications/PublicWebSite.Host/PublicWebSiteHostModule.cs b/samples/MicroserviceDemo/applications/PublicWebSite.Host/PublicWebSiteHostModule.cs index 0843eae579..66ea6d174c 100644 --- a/samples/MicroserviceDemo/applications/PublicWebSite.Host/PublicWebSiteHostModule.cs +++ b/samples/MicroserviceDemo/applications/PublicWebSite.Host/PublicWebSiteHostModule.cs @@ -52,7 +52,6 @@ namespace PublicWebSite.Host }) .AddCookie("Cookies", options => { - options.Cookie.Expiration = TimeSpan.FromDays(365); options.ExpireTimeSpan = TimeSpan.FromDays(365); }) .AddOpenIdConnect("oidc", options => From e37deb8ddc5607622bbb44b3119e36c5d86ec619 Mon Sep 17 00:00:00 2001 From: maliming Date: Thu, 31 Oct 2019 17:06:57 +0800 Subject: [PATCH 04/11] Grant permissions to backend-admin-app-client --- .../applications/AuthServer.Host/AuthServerDataSeeder.cs | 1 + .../BackendAdminApp.Host/BackendAdminAppHostModule.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/samples/MicroserviceDemo/applications/AuthServer.Host/AuthServerDataSeeder.cs b/samples/MicroserviceDemo/applications/AuthServer.Host/AuthServerDataSeeder.cs index b10c5d626c..03850e6d4f 100644 --- a/samples/MicroserviceDemo/applications/AuthServer.Host/AuthServerDataSeeder.cs +++ b/samples/MicroserviceDemo/applications/AuthServer.Host/AuthServerDataSeeder.cs @@ -117,6 +117,7 @@ namespace AuthServer.Host commonScopes.Union(new[] { "BackendAdminAppGateway", "IdentityService", "ProductService" }), new[] { "hybrid" }, commonSecret, + permissions: new[] { IdentityPermissions.Users.Default, "ProductManagement.Product" }, redirectUri: "http://localhost:51954/signin-oidc", postLogoutRedirectUri: "http://localhost:51954/signout-callback-oidc" ); diff --git a/samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminAppHostModule.cs b/samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminAppHostModule.cs index cd7cd24231..d04fc1e656 100644 --- a/samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminAppHostModule.cs +++ b/samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminAppHostModule.cs @@ -99,6 +99,7 @@ namespace BackendAdminApp.Host app.UseVirtualFiles(); app.UseRouting(); app.UseAuthentication(); + app.UseAuthorization(); app.UseAbpRequestLocalization(); app.UseSwagger(); app.UseSwaggerUI(options => From c3331dfb3f4f995e4440604d06697043902d463c Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Thu, 31 Oct 2019 13:03:50 +0300 Subject: [PATCH 05/11] removed duplicate localization --- .../AbpIoLocalization/Www/Localization/Resources/en.json | 1 - 1 file changed, 1 deletion(-) diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/en.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/en.json index f298592477..6b0b071cfd 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/en.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/en.json @@ -100,7 +100,6 @@ "DistributedEventBus": "Distributed Event Bus", "DistributedEventBusWithRabbitMQIntegration": "Distributed Event Bus with RabbitMQ Integration", "TestInfrastructure": "Test Infrastructure", - "AuditLogging": "Audit Logging", "AuditLoggingEntityHistories": "Audit Logging & Entity Histories", "ObjectToObjectMapping": "Object to Object Mapping", "EmailSMSAbstractions": "Email & SMS Abstractions", From 3ee26bb41275b6121948a293f30379a5e893a27f Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Thu, 31 Oct 2019 13:26:25 +0300 Subject: [PATCH 06/11] fix localization --- .../AbpIoLocalization/Www/Localization/Resources/en.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/en.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/en.json index 6b0b071cfd..be193b7396 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/en.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/en.json @@ -29,15 +29,15 @@ "Authorization": "Authorization", "AuthorizationExplanation": "Advanced authorization with user, role and fine-grained permission system. Built on the Microsoft Identity library.", "MultiTenancy": "Multi-Tenancy", - "MultiTenancyExplanation": "SaaS applications made easy! Integrated multi-tenancy from database to UI.", + "MultiTenancyExplanationShort": "SaaS applications made easy! Integrated multi-tenancy from database to UI.", "CrossCuttingConcerns": "Cross Cutting Concerns", - "CrossCuttingConcernsExplanation": "Complete infrastructure for authorization, validation, exception handling, caching, audit logging, transaction management and so on.", + "CrossCuttingConcernsExplanationShort": "Complete infrastructure for authorization, validation, exception handling, caching, audit logging, transaction management and so on.", "BuiltInBundlingMinification": "Built-In Bundling & Minification", "BuiltInBundlingMinificationExplanation": "Stop to use external tools for bundling & minification. ABP offers a simpler, dynamic, powerful, modular and built-in way!", "VirtualFileSystem": "Virtual File System", "VirtualFileSystemExplanation": "Embed views, scripts, styles, images... into packages/libraries and reuse in different applications.", "Theming": "Theming", - "ThemingExplanation": "Use and customize the bootstrap-based standard UI theme or create your own one.", + "ThemingExplanationShort": "Use and customize the bootstrap-based standard UI theme or create your own one.", "BootstrapTagHelpersDynamicForms": "Bootstrap Tag Helpers & Dynamic Forms", "BootstrapTagHelpersDynamicFormsExplanation": "Built-in background job system that can be integrated to Hangfire, RabbitMQ or any tool you like.", //TODO explanation doesn't match. "HTTPAPIsDynamicProxies": "HTTP APIs & Dynamic Proxies", From 95b02ec83e37f200330b026366dbf6b86053dcd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20Y=C3=BCksel=20POLAT?= Date: Thu, 31 Oct 2019 16:39:05 +0300 Subject: [PATCH 07/11] Create-Aspnet-Core-Application Image path fixed. --- docs/en/Getting-Started-AspNetCore-Application.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/Getting-Started-AspNetCore-Application.md b/docs/en/Getting-Started-AspNetCore-Application.md index f0a715aacd..4abcd039c9 100644 --- a/docs/en/Getting-Started-AspNetCore-Application.md +++ b/docs/en/Getting-Started-AspNetCore-Application.md @@ -14,7 +14,7 @@ This tutorial explains how to start ABP from scratch with minimal dependencies. 3. Press to the create button: -![create-aspnet-core-application](D:\Github\abp\docs\en\images\create-aspnet-core-application.png) +![create-aspnet-core-application](images/create-aspnet-core-application.png) ## Install Volo.Abp.AspNetCore.Mvc Package From a1466b67d84095529ea15ae433eaf871672c2c0e Mon Sep 17 00:00:00 2001 From: maliming Date: Fri, 1 Nov 2019 11:03:30 +0800 Subject: [PATCH 08/11] Cli new command to create a project folder. Resolve #2056 --- .../Volo/Abp/Cli/Commands/NewCommand.cs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs index e30ed7a77f..3bebf3103a 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs @@ -71,18 +71,13 @@ namespace Volo.Abp.Cli.Commands } var outputFolder = commandLineArgs.Options.GetOrNull(Options.OutputFolder.Short, Options.OutputFolder.Long); - if (outputFolder != null) - { - if (!Directory.Exists(outputFolder)) - { - Directory.CreateDirectory(outputFolder); - } - outputFolder = Path.GetFullPath(outputFolder); - } - else + outputFolder = Path.Combine(outputFolder != null ? Path.GetFullPath(outputFolder) : Directory.GetCurrentDirectory(), + SolutionName.Parse(commandLineArgs.Target).FullName); + + if (!Directory.Exists(outputFolder)) { - outputFolder = Directory.GetCurrentDirectory(); + Directory.CreateDirectory(outputFolder); } Logger.LogInformation("Output folder: " + outputFolder); From 634aebabd106a29f69370d6bfb02b4a90cefb12b Mon Sep 17 00:00:00 2001 From: maliming Date: Fri, 1 Nov 2019 11:16:09 +0800 Subject: [PATCH 09/11] fix localization. 3ee26bb41275b6121948a293f30379a5e893a27f --- .../Www/Localization/Resources/zh-Hans.json | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/zh-Hans.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/zh-Hans.json index a0a3ff0d40..b545cd8e16 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/zh-Hans.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/zh-Hans.json @@ -29,15 +29,15 @@ "Authorization": "授权", "AuthorizationExplanation": "具有用户,角色和细粒度权限系统的高级授权. 建立在Microsoft Identity库上.", "MultiTenancy": "多租户", - "MultiTenancyExplanation": "SaaS应用程序变得简单! 从数据库到UI的多租户集成.", + "MultiTenancyExplanationShort": "SaaS应用程序变得简单! 从数据库到UI的多租户集成.", "CrossCuttingConcerns": "横切关注点", - "CrossCuttingConcernsExplanation": "完整的基础架构,用于授权,验证,异常处理,缓存,审计日志记录,事务管理等.", + "CrossCuttingConcernsExplanationShort": "完整的基础架构,用于授权,验证,异常处理,缓存,审计日志记录,事务管理等.", "BuiltInBundlingMinification": "内置Bundling & Minification", "BuiltInBundlingMinificationExplanation": "无需使用外部工具进行Bundling & Minification. ABP提供了一种更简单,动态,功能强大,模块化和内置的方式!", "VirtualFileSystem": "虚拟文件系统", "VirtualFileSystemExplanation": "将视图,脚本,样式,图像...嵌入到包/库中,并在不同的应用程序中重复使用.", "Theming": "主题", - "ThemingExplanation": "使用和定制基于bootstrap的标准UI主题,或创建自己的主题.", + "ThemingExplanationShort": "使用和定制基于bootstrap的标准UI主题,或创建自己的主题.", "BootstrapTagHelpersDynamicForms": "Bootstrap Tag Helpers和动态表单", "BootstrapTagHelpersDynamicFormsExplanation": "内置的后台作业系统可以集成到Hangfire,RabbitMQ或您喜欢的任何工具中.", //TODO explanation doesn't match. "HTTPAPIsDynamicProxies": "HTTP APIs和动态代理", @@ -100,7 +100,6 @@ "DistributedEventBus": "分布式事件总线", "DistributedEventBusWithRabbitMQIntegration": "具有RabbitMQ集成的分布式事件总线", "TestInfrastructure": "测试基础设施", - "AuditLogging": "审计日志", "AuditLoggingEntityHistories": "审计日志和实体历史", "ObjectToObjectMapping": "对象映射", "EmailSMSAbstractions": "电子邮件和短信抽象", From 6ade5553a2f140aa1954cd1efc874b2258bbe153 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Fri, 1 Nov 2019 10:55:09 +0300 Subject: [PATCH 10/11] remove duplicate virtual usages --- .../Volo/Abp/Identity/IdentityUserLookupAppService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserLookupAppService.cs b/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserLookupAppService.cs index 6325daa535..48d42c4579 100644 --- a/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserLookupAppService.cs +++ b/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserLookupAppService.cs @@ -16,7 +16,7 @@ namespace Volo.Abp.Identity UserLookupServiceProvider = userLookupServiceProvider; } - public virtual virtual async Task FindByIdAsync(Guid id) + public virtual async Task FindByIdAsync(Guid id) { var userData = await UserLookupServiceProvider.FindByIdAsync(id); if (userData == null) @@ -27,7 +27,7 @@ namespace Volo.Abp.Identity return new UserData(userData); } - public virtual virtual async Task FindByUserNameAsync(string userName) + public virtual async Task FindByUserNameAsync(string userName) { var userData = await UserLookupServiceProvider.FindByUserNameAsync(userName); if (userData == null) From 28a8cb70e4f064d9f538059047fb056c707dc2e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Fri, 1 Nov 2019 13:11:59 +0300 Subject: [PATCH 11/11] #2052 Check if GetLocalEvents() and GetDistributedEvents() returns null. --- .../Volo/Abp/EntityFrameworkCore/AbpDbContext.cs | 8 ++++---- .../Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContext.cs b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContext.cs index 3d4b45d75d..0d45d719fd 100644 --- a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContext.cs +++ b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContext.cs @@ -224,15 +224,15 @@ namespace Volo.Abp.EntityFrameworkCore return; } - var localEvents = generatesDomainEventsEntity.GetLocalEvents().ToArray(); - if (localEvents.Any()) + var localEvents = generatesDomainEventsEntity.GetLocalEvents()?.ToArray(); + if (localEvents != null && localEvents.Any()) { changeReport.DomainEvents.AddRange(localEvents.Select(eventData => new DomainEventEntry(entityAsObj, eventData))); generatesDomainEventsEntity.ClearLocalEvents(); } - var distributedEvents = generatesDomainEventsEntity.GetDistributedEvents().ToArray(); - if (distributedEvents.Any()) + var distributedEvents = generatesDomainEventsEntity.GetDistributedEvents()?.ToArray(); + if (distributedEvents != null && distributedEvents.Any()) { changeReport.DistributedEvents.AddRange(distributedEvents.Select(eventData => new DomainEventEntry(entityAsObj, eventData))); generatesDomainEventsEntity.ClearDistributedEvents(); diff --git a/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs b/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs index deca912bec..057f72bbb5 100644 --- a/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs +++ b/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs @@ -359,8 +359,8 @@ namespace Volo.Abp.Domain.Repositories.MongoDB return; } - var localEvents = generatesDomainEventsEntity.GetLocalEvents().ToArray(); - if (localEvents.Any()) + var localEvents = generatesDomainEventsEntity.GetLocalEvents()?.ToArray(); + if (localEvents != null && localEvents.Any()) { foreach (var localEvent in localEvents) { @@ -370,8 +370,8 @@ namespace Volo.Abp.Domain.Repositories.MongoDB generatesDomainEventsEntity.ClearLocalEvents(); } - var distributedEvents = generatesDomainEventsEntity.GetDistributedEvents().ToArray(); - if (distributedEvents.Any()) + var distributedEvents = generatesDomainEventsEntity.GetDistributedEvents()?.ToArray(); + if (distributedEvents != null && distributedEvents.Any()) { foreach (var distributedEvent in distributedEvents) {