Skip to content

Commit 378d8cc

Browse files
VCST-4203: Remove obsolete code (#2963)
1 parent b24dd98 commit 378d8cc

File tree

20 files changed

+4
-459
lines changed

20 files changed

+4
-459
lines changed

src/VirtoCommerce.Platform.Core/Bus/IHandlerRegistrar.cs

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/VirtoCommerce.Platform.Core/Bus/InProcessBus.cs

Lines changed: 1 addition & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@
55
using System.Threading.Tasks;
66
using Microsoft.Extensions.Logging;
77
using VirtoCommerce.Platform.Core.Events;
8-
using VirtoCommerce.Platform.Core.Messages;
98

109
namespace VirtoCommerce.Platform.Core.Bus
1110
{
12-
public class InProcessBus : IEventHandlerRegistrar, IEventPublisher, IHandlerRegistrar
11+
public class InProcessBus : IEventHandlerRegistrar, IEventPublisher
1312
{
1413
private readonly ILogger<InProcessBus> _logger;
1514
private readonly List<HandlerWrapper> _handlers = [];
@@ -19,47 +18,6 @@ public InProcessBus(ILogger<InProcessBus> logger)
1918
_logger = logger;
2019
}
2120

22-
[Obsolete("Use IApplicationBuilder.RegisterEventHandler<TEvent, THandler>()", DiagnosticId = "VC0008", UrlFormat = "https://docs.virtocommerce.org/products/products-virto3-versions")]
23-
public void RegisterEventHandler<T>(Func<T, Task> handler)
24-
where T : IEvent
25-
{
26-
var eventType = typeof(T);
27-
28-
var handlerWrapper = new HandlerWrapper
29-
{
30-
EventType = eventType,
31-
HandlerModuleName = handler.Target?.GetType().Module.Assembly.GetName().Name,
32-
Handler = (message, _) => handler((T)message),
33-
Logger = _logger
34-
};
35-
36-
_handlers.Add(handlerWrapper);
37-
}
38-
39-
[Obsolete("Use IApplicationBuilder.RegisterEventHandler<TEvent, THandler>()", DiagnosticId = "VC0008", UrlFormat = "https://docs.virtocommerce.org/products/products-virto3-versions")]
40-
public void RegisterEventHandler<T>(Func<T, CancellationToken, Task> handler)
41-
where T : IEvent
42-
{
43-
RegisterHandler(handler);
44-
}
45-
46-
[Obsolete("Use IApplicationBuilder.RegisterEventHandler<TEvent, THandler>()", DiagnosticId = "VC0008", UrlFormat = "https://docs.virtocommerce.org/products/products-virto3-versions")]
47-
public void RegisterHandler<T>(Func<T, CancellationToken, Task> handler)
48-
where T : IMessage
49-
{
50-
var eventType = typeof(T);
51-
52-
var handlerWrapper = new HandlerWrapper
53-
{
54-
EventType = eventType,
55-
HandlerModuleName = handler.Target?.GetType().Module.Assembly.GetName().Name,
56-
Handler = (message, token) => handler((T)message, token),
57-
Logger = _logger
58-
};
59-
60-
_handlers.Add(handlerWrapper);
61-
}
62-
6321
public void RegisterEventHandler<T>(IEventHandler<T> handler)
6422
where T : IEvent
6523
{

src/VirtoCommerce.Platform.Core/Common/AsyncLock.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,6 @@ public static AsyncLock GetLockByKey(string key)
4141
return new AsyncLock(key);
4242
}
4343

44-
[Obsolete("Use LockAsync()", DiagnosticId = "VC0009", UrlFormat = "https://docs.virtocommerce.org/products/products-virto3-versions")]
45-
public Task<IDisposable> GetReleaserAsync()
46-
{
47-
return LockAsync();
48-
}
49-
5044
public async Task<IDisposable> LockAsync()
5145
{
5246
await GetOrCreate(_key).WaitAsync().ConfigureAwait(false);

src/VirtoCommerce.Platform.Core/Events/ApplicationBuilderExtensions.cs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
using System;
2-
using System.Threading;
3-
using System.Threading.Tasks;
41
using Microsoft.AspNetCore.Builder;
52
using Microsoft.Extensions.DependencyInjection;
63

@@ -18,15 +15,6 @@ public static IApplicationBuilder RegisterEventHandler<TEvent, THandler>(this IA
1815
return applicationBuilder;
1916
}
2017

21-
[Obsolete("Use IApplicationBuilder.RegisterEventHandler<TEvent, THandler>()", DiagnosticId = "VC0008", UrlFormat = "https://docs.virtocommerce.org/products/products-virto3-versions")]
22-
public static IApplicationBuilder RegisterEventHandler<TEvent>(this IApplicationBuilder applicationBuilder, Func<TEvent, Task> handler)
23-
where TEvent : IEvent
24-
{
25-
var registrar = applicationBuilder.ApplicationServices.GetRequiredService<IEventHandlerRegistrar>();
26-
registrar.RegisterEventHandler(handler);
27-
return applicationBuilder;
28-
}
29-
3018
public static IApplicationBuilder RegisterCancellableEventHandler<TEvent, THandler>(this IApplicationBuilder applicationBuilder)
3119
where TEvent : IEvent
3220
where THandler : ICancellableEventHandler<TEvent>
@@ -37,15 +25,6 @@ public static IApplicationBuilder RegisterCancellableEventHandler<TEvent, THandl
3725
return applicationBuilder;
3826
}
3927

40-
[Obsolete("Use IApplicationBuilder.RegisterEventHandler<TEvent, THandler>()", DiagnosticId = "VC0008", UrlFormat = "https://docs.virtocommerce.org/products/products-virto3-versions")]
41-
public static IApplicationBuilder RegisterCancellableEventHandler<TEvent>(this IApplicationBuilder applicationBuilder, Func<TEvent, CancellationToken, Task> handler)
42-
where TEvent : IEvent
43-
{
44-
var registrar = applicationBuilder.ApplicationServices.GetRequiredService<IEventHandlerRegistrar>();
45-
registrar.RegisterEventHandler(handler);
46-
return applicationBuilder;
47-
}
48-
4928
public static IApplicationBuilder UnregisterEventHandler<TEvent, THandler>(this IApplicationBuilder applicationBuilder)
5029
where TEvent : IEvent
5130
where THandler : IEventHandler<TEvent>

src/VirtoCommerce.Platform.Core/Events/EventSuppressor.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ private void Dispose(bool disposing)
3838
/// </summary>
3939
public static bool EventsSuppressed => _eventsSuppressedStorage.Value;
4040

41-
[Obsolete("Use SuppressEvents()", DiagnosticId = "VC0008", UrlFormat = "https://docs.virtocommerce.org/products/products-virto3-versions/")]
42-
public static IDisposable SupressEvents() => SuppressEvents();
43-
4441
/// <summary>
4542
/// The flag indicates that events are suppressed for the current asynchronous control flow
4643
/// </summary>

src/VirtoCommerce.Platform.Core/Events/IEventHandlerRegistrar.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
11
using System;
2-
using System.Threading;
3-
using System.Threading.Tasks;
42

53
namespace VirtoCommerce.Platform.Core.Events;
64

75
public interface IEventHandlerRegistrar
86
{
9-
[Obsolete("Use IApplicationBuilder.RegisterEventHandler<TEvent, THandler>()", DiagnosticId = "VC0008", UrlFormat = "https://docs.virtocommerce.org/products/products-virto3-versions")]
10-
void RegisterEventHandler<T>(Func<T, Task> handler) where T : IEvent;
11-
12-
[Obsolete("Use IApplicationBuilder.RegisterEventHandler<TEvent, THandler>()", DiagnosticId = "VC0008", UrlFormat = "https://docs.virtocommerce.org/products/products-virto3-versions")]
13-
void RegisterEventHandler<T>(Func<T, CancellationToken, Task> handler) where T : IEvent;
14-
157
void RegisterEventHandler<T>(IEventHandler<T> handler) where T : IEvent;
168
void RegisterEventHandler<T>(ICancellableEventHandler<T> handler) where T : IEvent;
179

src/VirtoCommerce.Platform.Core/Security/IExternalSigninService.cs

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/VirtoCommerce.Platform.Data/Extensions/ServiceCollectionExtensions.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ public static IServiceCollection AddPlatformServices(this IServiceCollection ser
3838

3939
services.AddSingleton<InProcessBus>();
4040
services.AddSingleton<IEventHandlerRegistrar>(x => x.GetRequiredService<InProcessBus>());
41-
services.AddSingleton<IHandlerRegistrar>(x => x.GetRequiredService<InProcessBus>());
4241
services.AddSingleton<IEventPublisher>(x => x.GetRequiredService<InProcessBus>());
4342
services.AddTransient<IChangeLogService, ChangeLogService>();
4443
services.AddTransient<ILastModifiedDateTime, ChangeLogService>();

src/VirtoCommerce.Platform.Data/Repositories/PlatformDbContext.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ namespace VirtoCommerce.Platform.Data.Repositories
99
{
1010
public class PlatformDbContext : DbContextBase
1111
{
12-
[Obsolete("Use Length128 or IdLength", DiagnosticId = "VC0009", UrlFormat = "https://docs.virtocommerce.org/products/products-virto3-versions")]
13-
protected const int _idLength128 = 128;
14-
1512
[Obsolete("Use Length64 or UserNameLength", DiagnosticId = "VC0010", UrlFormat = "https://docs.virtocommerce.org/products/products-virto3-versions")]
1613
protected const int _idLength64 = 64;
1714

src/VirtoCommerce.Platform.Hangfire/Extensions/RecurringJobExtensions.cs

Lines changed: 0 additions & 158 deletions
This file was deleted.

0 commit comments

Comments
 (0)