Esempio n. 1
0
        private void AddInternalServices()
        {
            Scopeds.AddDelegate <IServiceResolver>(resolver => resolver);

            if (!Contains(typeof(IServiceProvider)))
            {
                Scopeds.AddDelegate <IServiceProvider>(resolver => resolver);
            }
            if (!Contains(typeof(IPropertyInjectorFactory)))
            {
                Scopeds.AddType <IPropertyInjectorFactory, PropertyInjectorFactory>();
            }
            if (!Contains(typeof(IScopeResolverFactory)))
            {
                Scopeds.AddDelegate <IScopeResolverFactory>(resolver => new ScopeResolverFactory(resolver));
            }
            Singletons.AddInstance <IAspectConfiguration>(_configuration);
            if (!Contains(typeof(ITransientServiceAccessor <>)))
            {
                Singletons.AddType(typeof(ITransientServiceAccessor <>), typeof(TransientServiceAccessor <>));
            }

            //add DynamicProxy services
            Singletons.AddType <IInterceptorSelector, ConfigureInterceptorSelector>();
            Singletons.AddType <IInterceptorSelector, AttributeInterceptorSelector>();
            Singletons.AddType <IAdditionalInterceptorSelector, AttributeAdditionalInterceptorSelector>();
            if (!Contains(typeof(IInterceptorCollector)))
            {
                Singletons.AddType <IInterceptorCollector, InterceptorCollector>();
            }
            if (!Contains(typeof(IAspectValidatorBuilder)))
            {
                Singletons.AddType <IAspectValidatorBuilder, AspectValidatorBuilder>();
            }
            if (!Contains(typeof(IAspectContextFactory)))
            {
                Scopeds.AddType <IAspectContextFactory, AspectContextFactory>();
            }
            if (!Contains(typeof(IAspectBuilderFactory)))
            {
                Singletons.AddType <IAspectBuilderFactory, AspectBuilderFactory>();
            }
            if (!Contains(typeof(IAspectActivatorFactory)))
            {
                Scopeds.AddType <IAspectActivatorFactory, AspectActivatorFactory>();
            }
            if (!Contains(typeof(IProxyGenerator)))
            {
                Scopeds.AddType <IProxyGenerator, ProxyGenerator>();
            }
            if (!Contains(typeof(IProxyTypeGenerator)))
            {
                Singletons.AddType <IProxyTypeGenerator, ProxyTypeGenerator>();
            }
            if (!Contains(typeof(IParameterInterceptorSelector)))
            {
                Scopeds.AddType <IParameterInterceptorSelector, ParameterInterceptorSelector>();
            }
            if (!Contains(typeof(IAspectCachingProvider)))
            {
                Singletons.AddType <IAspectCachingProvider, AspectCachingProvider>();
            }
        }