From 69a82a9f4b8e36c802f2b665cbdd67da26d9f055 Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Mon, 24 Jan 2022 21:56:46 +0800 Subject: [PATCH 1/3] Add AbpRebusEventHandlerStep --- .../EventBus/Rebus/AbpEventBusRebusModule.cs | 15 ++++++++++++- .../EventBus/Rebus/AbpRebusEventBusOptions.cs | 13 +---------- .../Rebus/AbpRebusEventHandlerStep.cs | 22 +++++++++++++++++++ .../Rebus/RebusDistributedEventBus.cs | 10 +++++++-- 4 files changed, 45 insertions(+), 15 deletions(-) create mode 100644 framework/src/Volo.Abp.EventBus.Rebus/Volo/Abp/EventBus/Rebus/AbpRebusEventHandlerStep.cs diff --git a/framework/src/Volo.Abp.EventBus.Rebus/Volo/Abp/EventBus/Rebus/AbpEventBusRebusModule.cs b/framework/src/Volo.Abp.EventBus.Rebus/Volo/Abp/EventBus/Rebus/AbpEventBusRebusModule.cs index 657c34d2be..e65d86f3c5 100644 --- a/framework/src/Volo.Abp.EventBus.Rebus/Volo/Abp/EventBus/Rebus/AbpEventBusRebusModule.cs +++ b/framework/src/Volo.Abp.EventBus.Rebus/Volo/Abp/EventBus/Rebus/AbpEventBusRebusModule.cs @@ -1,5 +1,7 @@ using Microsoft.Extensions.DependencyInjection; using Rebus.Handlers; +using Rebus.Pipeline; +using Rebus.Pipeline.Receive; using Rebus.ServiceProvider; using Volo.Abp.Modularity; @@ -21,6 +23,17 @@ public class AbpEventBusRebusModule : AbpModule context.Services.AddRebus(configure => { + configure.Options(options => + { + options.Decorate(d => + { + var step = new AbpRebusEventHandlerStep(); + var pipeline = d.Get(); + + return new PipelineStepInjector(pipeline).OnReceive(step, PipelineRelativePosition.After, typeof(ActivateHandlersStep)); + }); + }); + preActions.Configure().Configurer?.Invoke(configure); return configure; }); @@ -35,4 +48,4 @@ public class AbpEventBusRebusModule : AbpModule .GetRequiredService() .Initialize(); } -} \ No newline at end of file +} diff --git a/framework/src/Volo.Abp.EventBus.Rebus/Volo/Abp/EventBus/Rebus/AbpRebusEventBusOptions.cs b/framework/src/Volo.Abp.EventBus.Rebus/Volo/Abp/EventBus/Rebus/AbpRebusEventBusOptions.cs index 5238cdd8bb..4c39b9bf1d 100644 --- a/framework/src/Volo.Abp.EventBus.Rebus/Volo/Abp/EventBus/Rebus/AbpRebusEventBusOptions.cs +++ b/framework/src/Volo.Abp.EventBus.Rebus/Volo/Abp/EventBus/Rebus/AbpRebusEventBusOptions.cs @@ -20,24 +20,13 @@ public class AbpRebusEventBusOptions } private Action _configurer; - [NotNull] - public Func Publish { - get => _publish; - set => _publish = Check.NotNull(value, nameof(value)); - } - private Func _publish; + public Func Publish { get; set; } public AbpRebusEventBusOptions() { - _publish = DefaultPublish; _configurer = DefaultConfigure; } - private async Task DefaultPublish(IBus bus, Type eventType, object eventData) - { - await bus.Advanced.Routing.Send(InputQueueName, eventData); - } - private void DefaultConfigure(RebusConfigurer configure) { configure.Subscriptions(s => s.StoreInMemory()); diff --git a/framework/src/Volo.Abp.EventBus.Rebus/Volo/Abp/EventBus/Rebus/AbpRebusEventHandlerStep.cs b/framework/src/Volo.Abp.EventBus.Rebus/Volo/Abp/EventBus/Rebus/AbpRebusEventHandlerStep.cs new file mode 100644 index 0000000000..c0c655b596 --- /dev/null +++ b/framework/src/Volo.Abp.EventBus.Rebus/Volo/Abp/EventBus/Rebus/AbpRebusEventHandlerStep.cs @@ -0,0 +1,22 @@ +using System; +using System.Linq; +using System.Threading.Tasks; +using Rebus.Messages; +using Rebus.Pipeline; +using Rebus.Pipeline.Receive; + +namespace Volo.Abp.EventBus.Rebus; + +public class AbpRebusEventHandlerStep : IIncomingStep +{ + public Task Process(IncomingStepContext context, Func next) + { + var message = context.Load(); + var handlerInvokers = context.Load().ToList(); + + handlerInvokers.RemoveAll(x => x.Handler.GetType() == typeof(RebusDistributedEventHandlerAdapter)); + context.Save(new HandlerInvokers(message, handlerInvokers)); + + return next(); + } +} diff --git a/framework/src/Volo.Abp.EventBus.Rebus/Volo/Abp/EventBus/Rebus/RebusDistributedEventBus.cs b/framework/src/Volo.Abp.EventBus.Rebus/Volo/Abp/EventBus/Rebus/RebusDistributedEventBus.cs index d637f3fe89..cf6c1d6b0f 100644 --- a/framework/src/Volo.Abp.EventBus.Rebus/Volo/Abp/EventBus/Rebus/RebusDistributedEventBus.cs +++ b/framework/src/Volo.Abp.EventBus.Rebus/Volo/Abp/EventBus/Rebus/RebusDistributedEventBus.cs @@ -148,9 +148,15 @@ public class RebusDistributedEventBus : DistributedEventBusBase, ISingletonDepen await TriggerHandlersAsync(eventType, eventData); } - protected override async Task PublishToEventBusAsync(Type eventType, object eventData) + protected async override Task PublishToEventBusAsync(Type eventType, object eventData) { - await AbpRebusEventBusOptions.Publish(Rebus, eventType, eventData); + if (AbpRebusEventBusOptions.Publish != null) + { + await AbpRebusEventBusOptions.Publish(Rebus, eventType, eventData); + return; + } + + await Rebus.Publish(eventData); } protected override void AddToUnitOfWork(IUnitOfWork unitOfWork, UnitOfWorkEventRecord eventRecord) From fe5cfaef29514a39dad5c2a9f3e7963d211271c6 Mon Sep 17 00:00:00 2001 From: maliming Date: Tue, 25 Jan 2022 08:48:24 +0800 Subject: [PATCH 2/3] Update POST.md --- docs/en/Blog-Posts/2022-01-11 v5_1_Release_Stable/POST.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/en/Blog-Posts/2022-01-11 v5_1_Release_Stable/POST.md b/docs/en/Blog-Posts/2022-01-11 v5_1_Release_Stable/POST.md index 47c7832695..4fe7bd39b9 100644 --- a/docs/en/Blog-Posts/2022-01-11 v5_1_Release_Stable/POST.md +++ b/docs/en/Blog-Posts/2022-01-11 v5_1_Release_Stable/POST.md @@ -104,6 +104,8 @@ Here are some other notable changes that come with this release: * Support markdown in [CMS-Kit comments ](https://docs.abp.io/en/abp/latest/Modules/Cms-Kit/Comments)feature ([#10792](https://github.com/abpframework/abp/pull/10792)) * Used file scoped namespaces for all the ABP Framework source code :) ([#10552](https://github.com/abpframework/abp/pull/10696)) +* Developers should control `EnableLegacyTimestampBehavior` when using PostgreSQL. [#11371](https://github.com/abpframework/abp/pull/11371) [#65](https://github.com/abpframework/eShopOnAbp/pull/65) + All issues & PRs in [5.1 milesone](https://github.com/abpframework/abp/milestone/60?closed=1). From 1b25289fee715d0901aad5b92658797c05708522 Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Tue, 25 Jan 2022 17:11:30 +0800 Subject: [PATCH 3/3] Blazor-server Support deploy sub application --- .../Themes/Basic/LanguageSwitch.razor | 8 ++++---- .../Themes/Basic/LoginDisplay.razor | 6 +++--- .../Themes/Basic/Branding.razor | 2 +- .../Pages/Index.razor | 4 ++-- .../Pages/_Host.cshtml | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/modules/basic-theme/src/Volo.Abp.AspNetCore.Components.Server.BasicTheme/Themes/Basic/LanguageSwitch.razor b/modules/basic-theme/src/Volo.Abp.AspNetCore.Components.Server.BasicTheme/Themes/Basic/LanguageSwitch.razor index 2a0ab7397a..75b64e05b7 100644 --- a/modules/basic-theme/src/Volo.Abp.AspNetCore.Components.Server.BasicTheme/Themes/Basic/LanguageSwitch.razor +++ b/modules/basic-theme/src/Volo.Abp.AspNetCore.Components.Server.BasicTheme/Themes/Basic/LanguageSwitch.razor @@ -30,7 +30,7 @@ CultureInfo.CurrentCulture.Name, CultureInfo.CurrentUICulture.Name ); - + if (currentLanguage == null) { var localizationOptions = await RequestLocalizationOptionsProvider.GetLocalizationOptionsAsync(); @@ -56,10 +56,10 @@ private void ChangeLanguage(LanguageInfo language) { - var relativeUrl = NavigationManager.Uri.RemovePreFix(NavigationManager.BaseUri).EnsureStartsWith('/'); - + var relativeUrl = NavigationManager.Uri.RemovePreFix(NavigationManager.BaseUri).EnsureStartsWith('/').EnsureStartsWith('~'); + NavigationManager.NavigateTo( - $"/Abp/Languages/Switch?culture={language.CultureName}&uiCulture={language.UiCultureName}&returnUrl={relativeUrl}", + $"Abp/Languages/Switch?culture={language.CultureName}&uiCulture={language.UiCultureName}&returnUrl={relativeUrl}", forceLoad: true ); } diff --git a/modules/basic-theme/src/Volo.Abp.AspNetCore.Components.Server.BasicTheme/Themes/Basic/LoginDisplay.razor b/modules/basic-theme/src/Volo.Abp.AspNetCore.Components.Server.BasicTheme/Themes/Basic/LoginDisplay.razor index 07e4d9918d..adc42e8da3 100644 --- a/modules/basic-theme/src/Volo.Abp.AspNetCore.Components.Server.BasicTheme/Themes/Basic/LoginDisplay.razor +++ b/modules/basic-theme/src/Volo.Abp.AspNetCore.Components.Server.BasicTheme/Themes/Basic/LoginDisplay.razor @@ -26,13 +26,13 @@ { @foreach (var menuItem in Menu.Items) { - @menuItem.DisplayName + @menuItem.DisplayName } } - @L["Login"] + @L["Login"] - \ No newline at end of file + diff --git a/modules/basic-theme/src/Volo.Abp.AspNetCore.Components.Web.BasicTheme/Themes/Basic/Branding.razor b/modules/basic-theme/src/Volo.Abp.AspNetCore.Components.Web.BasicTheme/Themes/Basic/Branding.razor index 5e0537b2b2..a0c91635a9 100644 --- a/modules/basic-theme/src/Volo.Abp.AspNetCore.Components.Web.BasicTheme/Themes/Basic/Branding.razor +++ b/modules/basic-theme/src/Volo.Abp.AspNetCore.Components.Web.BasicTheme/Themes/Basic/Branding.razor @@ -3,7 +3,7 @@ @if (!BrandingProvider.LogoUrl.IsNullOrWhiteSpace()) { - @BrandingProvider.AppName + @BrandingProvider.AppName } @BrandingProvider.AppName diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server/Pages/Index.razor b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server/Pages/Index.razor index 93745851b5..4bb044a987 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server/Pages/Index.razor +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server/Pages/Index.razor @@ -12,10 +12,10 @@

Welcome to the Application

@L["LongWelcomeMessage"]

- + @if (!CurrentUser.IsAuthenticated) { - @L["Login"] + @L["Login"] } diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server/Pages/_Host.cshtml b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server/Pages/_Host.cshtml index 0da32f7519..f72161d5d4 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server/Pages/_Host.cshtml +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server/Pages/_Host.cshtml @@ -16,7 +16,7 @@ MyCompanyName.MyProjectName.Blazor.Server - +