mirror of https://github.com/abpframework/abp.git
10 changed files with 36 additions and 49 deletions
@ -1,31 +0,0 @@ |
|||||
using Microsoft.Extensions.DependencyInjection; |
|
||||
using Volo.Abp.Castle.DynamicProxy; |
|
||||
using Volo.Abp.Modularity; |
|
||||
|
|
||||
namespace Volo.Abp.Castle |
|
||||
{ |
|
||||
[DependsOn(typeof(AbpCastleCoreModule))] |
|
||||
public class AbpCastleCoreTestModule : AbpModule |
|
||||
{ |
|
||||
public override void PreConfigureServices(IServiceCollection services) |
|
||||
{ |
|
||||
services.OnServiceRegistred(RegisterTestInterceptors); |
|
||||
} |
|
||||
|
|
||||
public override void ConfigureServices(IServiceCollection services) |
|
||||
{ |
|
||||
services.AddAssemblyOf<AbpCastleCoreTestModule>(); |
|
||||
} |
|
||||
|
|
||||
private static void RegisterTestInterceptors(IOnServiceRegistredArgs registration) |
|
||||
{ |
|
||||
//TODO: Create an attribute to add interceptors!
|
|
||||
if (typeof(SimpleInterceptionTargetClass) == registration.ImplementationType) |
|
||||
{ |
|
||||
registration.Interceptors.Add<SimpleAsyncInterceptor>(); |
|
||||
registration.Interceptors.Add<SimpleSyncInterceptor>(); |
|
||||
registration.Interceptors.Add<SimpleAsyncInterceptor2>(); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,11 +1,10 @@ |
|||||
using System.Threading.Tasks; |
using System.Threading.Tasks; |
||||
using Volo.Abp.DynamicProxy; |
|
||||
using Volo.Abp.TestBase.Logging; |
using Volo.Abp.TestBase.Logging; |
||||
using Volo.DependencyInjection; |
using Volo.DependencyInjection; |
||||
|
|
||||
namespace Volo.Abp.Castle.DynamicProxy |
namespace Volo.Abp.DynamicProxy |
||||
{ |
{ |
||||
public class SimpleAsyncInterceptor : AbpInterceptor, ITransientDependency |
public class SimpleAsyncInterceptor : AbpInterceptor |
||||
{ |
{ |
||||
public override void Intercept(IAbpMethodInvocation invocation) |
public override void Intercept(IAbpMethodInvocation invocation) |
||||
{ |
{ |
||||
@ -1,4 +1,4 @@ |
|||||
namespace Volo.Abp.Castle.DynamicProxy |
namespace Volo.Abp.DynamicProxy |
||||
{ |
{ |
||||
public class SimpleAsyncInterceptor2 : SimpleAsyncInterceptor |
public class SimpleAsyncInterceptor2 : SimpleAsyncInterceptor |
||||
{ |
{ |
||||
@ -1,11 +1,10 @@ |
|||||
using System.Collections.Generic; |
using System.Collections.Generic; |
||||
using System.Threading.Tasks; |
using System.Threading.Tasks; |
||||
using Volo.Abp.TestBase.Logging; |
using Volo.Abp.TestBase.Logging; |
||||
using Volo.DependencyInjection; |
|
||||
|
|
||||
namespace Volo.Abp.Castle.DynamicProxy |
namespace Volo.Abp.DynamicProxy |
||||
{ |
{ |
||||
public class SimpleInterceptionTargetClass : ITransientDependency, ICanLogOnObject |
public class SimpleInterceptionTargetClass : ICanLogOnObject |
||||
{ |
{ |
||||
public List<string> Logs { get; } = new List<string>(); |
public List<string> Logs { get; } = new List<string>(); |
||||
|
|
||||
@ -1,10 +1,9 @@ |
|||||
using Volo.Abp.DynamicProxy; |
|
||||
using Volo.Abp.TestBase.Logging; |
using Volo.Abp.TestBase.Logging; |
||||
using Volo.DependencyInjection; |
using Volo.DependencyInjection; |
||||
|
|
||||
namespace Volo.Abp.Castle.DynamicProxy |
namespace Volo.Abp.DynamicProxy |
||||
{ |
{ |
||||
public class SimpleSyncInterceptor : AbpInterceptor, ITransientDependency |
public class SimpleSyncInterceptor : AbpInterceptor |
||||
{ |
{ |
||||
public override void Intercept(IAbpMethodInvocation invocation) |
public override void Intercept(IAbpMethodInvocation invocation) |
||||
{ |
{ |
||||
Loading…
Reference in new issue