Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
 public void AspectCoreProxyNewAndCall()
 {
     aspectcoreIoc.GetRequiredService <ISyncFunc2>().SyncCallNoParameters();
 }