mirror of https://github.com/abpframework/abp.git
5 changed files with 46 additions and 10 deletions
@ -1,16 +1,24 @@ |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.DynamicProxy; |
|||
using Volo.Abp.TestBase.Logging; |
|||
using Volo.DependencyInjection; |
|||
|
|||
namespace Volo.Abp.Castle.DynamicProxy |
|||
{ |
|||
public class SimpleInterceptor : IAbpInterceptor, ITransientDependency |
|||
public class SimpleInterceptor : IAbpInterceptor, /*IAbpAsyncInterceptor,*/ ITransientDependency |
|||
{ |
|||
public void Intercept(IAbpMethodInvocation invocation) |
|||
{ |
|||
(invocation.TargetObject as ICanLogOnObject)?.Logs?.Add("BeforeInvocation"); |
|||
(invocation.TargetObject as ICanLogOnObject)?.Logs?.Add("SimpleInterceptor_BeforeInvocation"); |
|||
invocation.Proceed(); |
|||
(invocation.TargetObject as ICanLogOnObject)?.Logs?.Add("AfterInvocation"); |
|||
(invocation.TargetObject as ICanLogOnObject)?.Logs?.Add("SimpleInterceptor_AfterInvocation"); |
|||
} |
|||
|
|||
//public async Task InterceptAsync(IAbpAsyncMethodInvocation invocation)
|
|||
//{
|
|||
// (invocation.TargetObject as ICanLogOnObject)?.Logs?.Add("SimpleInterceptor_BeforeInvocation");
|
|||
// await invocation.ProceedAsync();
|
|||
// (invocation.TargetObject as ICanLogOnObject)?.Logs?.Add("SimpleInterceptor_AfterInvocation");
|
|||
//}
|
|||
} |
|||
} |
|||
Loading…
Reference in new issue