|
|
@ -1,23 +1,20 @@ |
|
|
|
using Tiobon.Core.Common; |
|
|
|
using Castle.DynamicProxy; |
|
|
|
using Tiobon.Core.Common.LogHelper; |
|
|
|
|
|
|
|
using Tiobon.Core.Hubs; |
|
|
|
|
|
|
|
using Castle.DynamicProxy; |
|
|
|
|
|
|
|
using Microsoft.AspNetCore.Http; |
|
|
|
using Microsoft.AspNetCore.Http; |
|
|
|
using Microsoft.AspNetCore.SignalR; |
|
|
|
using Microsoft.AspNetCore.SignalR; |
|
|
|
using Newtonsoft.Json; |
|
|
|
using Newtonsoft.Json; |
|
|
|
using StackExchange.Profiling; |
|
|
|
using StackExchange.Profiling; |
|
|
|
using System; |
|
|
|
|
|
|
|
using System.Linq; |
|
|
|
|
|
|
|
using System.Reflection; |
|
|
|
using System.Reflection; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using Tiobon.Core.Common; |
|
|
|
|
|
|
|
using Tiobon.Core.Common.LogHelper; |
|
|
|
|
|
|
|
using Tiobon.Core.Hubs; |
|
|
|
|
|
|
|
|
|
|
|
namespace Tiobon.Core.AOP |
|
|
|
namespace Tiobon.Core.AOP; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
|
|
/// 拦截器TiobonLogAOP 继承IInterceptor接口 |
|
|
|
|
|
|
|
/// </summary> |
|
|
|
|
|
|
|
public class TiobonLogAOP : IInterceptor |
|
|
|
{ |
|
|
|
{ |
|
|
|
/// <summary> |
|
|
|
|
|
|
|
/// 拦截器TiobonLogAOP 继承IInterceptor接口 |
|
|
|
|
|
|
|
/// </summary> |
|
|
|
|
|
|
|
public class TiobonLogAOP : IInterceptor |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
private readonly IHubContext<ChatHub> _hubContext; |
|
|
|
private readonly IHubContext<ChatHub> _hubContext; |
|
|
|
private readonly IHttpContextAccessor _accessor; |
|
|
|
private readonly IHttpContextAccessor _accessor; |
|
|
|
|
|
|
|
|
|
|
@ -234,11 +231,11 @@ namespace Tiobon.Core.AOP |
|
|
|
(method.ReturnType.IsGenericType && method.ReturnType.GetGenericTypeDefinition() == typeof(Task<>)) |
|
|
|
(method.ReturnType.IsGenericType && method.ReturnType.GetGenericTypeDefinition() == typeof(Task<>)) |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
internal static class InternalAsyncHelper |
|
|
|
internal static class InternalAsyncHelper |
|
|
|
{ |
|
|
|
{ |
|
|
|
public static async Task AwaitTaskWithPostActionAndFinally(Task actualReturnValue, Func<Task> postAction, Action<Exception> finalAction) |
|
|
|
public static async Task AwaitTaskWithPostActionAndFinally(Task actualReturnValue, Func<Task> postAction, Action<Exception> finalAction) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Exception exception = null; |
|
|
|
Exception exception = null; |
|
|
@ -287,5 +284,4 @@ namespace Tiobon.Core.AOP |
|
|
|
.MakeGenericMethod(taskReturnType) |
|
|
|
.MakeGenericMethod(taskReturnType) |
|
|
|
.Invoke(null, new object[] {actualReturnValue, action, finalAction}); |
|
|
|
.Invoke(null, new object[] {actualReturnValue, action, finalAction}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |