From 1f9c6912d95a5014ece4c351362f2fa2053db18b Mon Sep 17 00:00:00 2001 From: maliming Date: Wed, 9 Mar 2022 09:32:20 +0800 Subject: [PATCH] Revert "Add `AbpUowHubFilter `." --- .../SignalR/AbpAspNetCoreSignalRModule.cs | 2 - .../AspNetCore/SignalR/Uow/AbpUowHubFilter.cs | 42 ------------------- .../SignalR/Uow/AbpUowHubFilterOptions.cs | 15 ------- 3 files changed, 59 deletions(-) delete mode 100644 framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/Uow/AbpUowHubFilter.cs delete mode 100644 framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/Uow/AbpUowHubFilterOptions.cs diff --git a/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/AbpAspNetCoreSignalRModule.cs b/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/AbpAspNetCoreSignalRModule.cs index 4673d8eb62..903e60a16f 100644 --- a/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/AbpAspNetCoreSignalRModule.cs +++ b/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/AbpAspNetCoreSignalRModule.cs @@ -10,7 +10,6 @@ using Microsoft.Extensions.Options; using Volo.Abp.AspNetCore.Auditing; using Volo.Abp.AspNetCore.SignalR.Auditing; using Volo.Abp.AspNetCore.SignalR.Authentication; -using Volo.Abp.AspNetCore.SignalR.Uow; using Volo.Abp.Auditing; using Volo.Abp.DependencyInjection; using Volo.Abp.Modularity; @@ -40,7 +39,6 @@ public class AbpAspNetCoreSignalRModule : AbpModule { options.AddFilter(); options.AddFilter(); - options.AddFilter(); options.AddFilter(); }); diff --git a/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/Uow/AbpUowHubFilter.cs b/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/Uow/AbpUowHubFilter.cs deleted file mode 100644 index b2f38c692b..0000000000 --- a/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/Uow/AbpUowHubFilter.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using System.Threading.Tasks; -using Microsoft.AspNetCore.SignalR; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Options; -using Volo.Abp.Uow; - -namespace Volo.Abp.AspNetCore.SignalR.Uow; - -public class AbpUowHubFilter : IHubFilter -{ - public virtual async ValueTask InvokeMethodAsync(HubInvocationContext invocationContext, Func> next) - { - object result = null; - - var options = await CreateOptionsAsync(invocationContext); - - var unitOfWorkManager = invocationContext.ServiceProvider.GetRequiredService(); - - using (var uow = unitOfWorkManager.Begin(options)) - { - result = await next(invocationContext); - await uow.CompleteAsync(); - } - - return result; - } - - private async Task CreateOptionsAsync(HubInvocationContext invocationContext) - { - var options = new AbpUnitOfWorkOptions(); - - var defaultOptions = invocationContext.ServiceProvider.GetRequiredService>().Value; - var uowHubFilterOptions = invocationContext.ServiceProvider.GetRequiredService>().Value; - options.IsTransactional = defaultOptions.CalculateIsTransactional( - autoValue: invocationContext.ServiceProvider.GetRequiredService().IsTransactional - ?? await uowHubFilterOptions.IsTransactional(invocationContext) - ); - - return options; - } -} diff --git a/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/Uow/AbpUowHubFilterOptions.cs b/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/Uow/AbpUowHubFilterOptions.cs deleted file mode 100644 index 679f341c30..0000000000 --- a/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/Uow/AbpUowHubFilterOptions.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Threading.Tasks; -using Microsoft.AspNetCore.SignalR; - -namespace Volo.Abp.AspNetCore.SignalR.Uow; - -public class AbpUowHubFilterOptions -{ - public Func> IsTransactional { get; set; } - - public AbpUowHubFilterOptions() - { - IsTransactional = context => Task.FromResult(true); - } -}