예제 #1
0
파일: Test.cs 프로젝트: NMSAzulX/Norns
        public Test()
        {
            ioc = new ServiceDefintions()
                  .AddSingleton <IInterceptorConfiguration>(i =>
            {
                var c = new InterceptorConfiguration();
                //c.Interceptors.Add(new TestInterceptor());
                return(c);
            })
                  .AddTransient <IInterceptorConfigurationHandler>(i =>
            {
                return(new InterceptorAttributeConfigurationHandler(null));
            })
                  .AddTransient <IInterceptorCreatorFactory, InterceptorCreatorFactory>()
                  .AddSingleton <IInterceptDelegateBuilder>(i =>
            {
                return(i.GetRequiredService <IInterceptorCreatorFactory>().Build());
            })
                  .AddTransient <ISyncFunc, SyncFunc>()
                  .AddTransient <ISyncFunc2, SyncFunc2>()
                  .BuildServiceProvider();

            real = ioc.GetRequiredService <ISyncFunc2>();
            real.SyncCallNoParameters();
            proxy = ioc.GetRequiredService <ISyncFunc>();
            proxy.SyncCallNoParameters();

            var containerBuilder = new ServiceContainer();

            aspectcoreIoc = containerBuilder.AddType <ISyncFunc2, SyncFunc2>(AspectCore.Injector.Lifetime.Transient)
                            .Build();
            aspectcoreProxy = aspectcoreIoc.GetRequiredService <ISyncFunc2>();
            aspectcoreProxy.SyncCallNoParameters();
        }
예제 #2
0
파일: Test.cs 프로젝트: NMSAzulX/Norns
 public void AspectCoreProxyNewAndCall()
 {
     aspectcoreIoc.GetRequiredService <ISyncFunc2>().SyncCallNoParameters();
 }