From 4fb72131906b53f2d29ed4da2e9c9ccc98ac80cd Mon Sep 17 00:00:00 2001 From: artem-dudarev Date: Tue, 5 Mar 2024 10:43:26 +0200 Subject: [PATCH] Make RegisterHandler() obsolete --- src/VirtoCommerce.Platform.Core/Bus/IHandlerRegistrar.cs | 1 + src/VirtoCommerce.Platform.Core/Bus/InProcessBus.cs | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/VirtoCommerce.Platform.Core/Bus/IHandlerRegistrar.cs b/src/VirtoCommerce.Platform.Core/Bus/IHandlerRegistrar.cs index 3404030056..011f8c5a30 100644 --- a/src/VirtoCommerce.Platform.Core/Bus/IHandlerRegistrar.cs +++ b/src/VirtoCommerce.Platform.Core/Bus/IHandlerRegistrar.cs @@ -7,6 +7,7 @@ namespace VirtoCommerce.Platform.Core.Bus { public interface IHandlerRegistrar { + [Obsolete("Use IApplicationBuilder.RegisterEventHandler<>()", DiagnosticId = "VC0008", UrlFormat = "https://docs.virtocommerce.org/products/products-virto3-versions")] void RegisterHandler(Func handler) where T : IMessage; } } diff --git a/src/VirtoCommerce.Platform.Core/Bus/InProcessBus.cs b/src/VirtoCommerce.Platform.Core/Bus/InProcessBus.cs index 59eb3569a2..f538addcda 100644 --- a/src/VirtoCommerce.Platform.Core/Bus/InProcessBus.cs +++ b/src/VirtoCommerce.Platform.Core/Bus/InProcessBus.cs @@ -38,9 +38,12 @@ public void RegisterEventHandler(Func handler) public void RegisterEventHandler(Func handler) where T : IEvent { +#pragma warning disable VC0008 // Type or member is obsolete RegisterHandler(handler); +#pragma warning restore VC0008 // Type or member is obsolete } + [Obsolete("Use IApplicationBuilder.RegisterEventHandler<>()", DiagnosticId = "VC0008", UrlFormat = "https://docs.virtocommerce.org/products/products-virto3-versions")] public void RegisterHandler(Func handler) where T : IMessage {