Manager that can handle the registrations of the service locator.
コード例 #1
0
ファイル: ServiceLocator.cs プロジェクト: SOHODeveloper/Catel
        /// <summary>
        /// Initializes a new instance of the <see cref="ServiceLocator"/> class.
        /// </summary>
        public ServiceLocator()
        {
            // Must be registered first, already resolved by TypeFactory
            RegisterInstance(typeof(IServiceLocator), this);

            _autoRegistrationManager = new ServiceLocatorAutoRegistrationManager(this);

            IgnoreRuntimeIncorrectUsageOfRegisterAttribute = true;
            AutomaticallyKeepContainersSynchronized        = true;
            SupportDependencyInjection = true;
            CanResolveNonAbstractTypesWithoutRegistration = true;

            // Register default implementations
            // TODO: Enable for CTL-272
            //RegisterType(typeof(ICollection<>), typeof(Collection<>));
            //RegisterType(typeof(IEnumerable<>), typeof(List<>));
            //RegisterType(typeof(IList<>), typeof(List<>));
        }
コード例 #2
0
ファイル: ServiceLocator.cs プロジェクト: yicong/Catel
        /// <summary>
        /// Initializes a new instance of the <see cref="ServiceLocator"/> class.
        /// </summary>
        public ServiceLocator()
        {
            // Must be registered first, already resolved by TypeFactory
            RegisterInstance(typeof(IServiceLocator), this);
            RegisterInstance(typeof(IDependencyResolver), IoCFactory.CreateDependencyResolverFunc(this));

            _typeFactory = IoCFactory.CreateTypeFactoryFunc(this);
            RegisterInstance(typeof(ITypeFactory), _typeFactory);

            _autoRegistrationManager = new ServiceLocatorAutoRegistrationManager(this);

            IgnoreRuntimeIncorrectUsageOfRegisterAttribute = true;
            CanResolveNonAbstractTypesWithoutRegistration  = true;

            // Register default implementations
            // TODO: Enable for CTL-272
            //RegisterType(typeof(ICollection<>), typeof(Collection<>));
            //RegisterType(typeof(IEnumerable<>), typeof(List<>));
            //RegisterType(typeof(IList<>), typeof(List<>));
        }
コード例 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ServiceLocator"/> class.
        /// </summary>
        public ServiceLocator()
        {
            _typeFactory             = new TypeFactory(this);
            _autoRegistrationManager = new ServiceLocatorAutoRegistrationManager(this);

            IgnoreRuntimeIncorrectUsageOfRegisterAttribute = true;
            AutomaticallyKeepContainersSynchronized        = true;
            SupportDependencyInjection = true;
            CanResolveNonAbstractTypesWithoutRegistration = true;

#if !NETFX_CORE
#if !WINDOWS_PHONE
            RegisterExternalContainerHelper(new MefHelper());
            RegisterExternalContainerHelper(new UnityHelper());
            RegisterExternalContainerHelper(new WindsorHelper());
#endif

            RegisterExternalContainerHelper(new NinjectHelper());
#endif

            RegisterInstance(typeof(IServiceLocator), this);
            RegisterInstance(typeof(ITypeFactory), _typeFactory);
        }
コード例 #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ServiceLocator"/> class.
        /// </summary>
        public ServiceLocator()
        {
            // Must be registered first, already resolved by TypeFactory
            RegisterInstance(typeof(IServiceLocator), this);
            RegisterInstance(typeof(IDependencyResolver), IoCFactory.CreateDependencyResolverFunc(this));

            _typeFactory = IoCFactory.CreateTypeFactoryFunc(this);
            RegisterInstance(typeof(ITypeFactory), _typeFactory);

            _autoRegistrationManager = new ServiceLocatorAutoRegistrationManager(this);

            IgnoreRuntimeIncorrectUsageOfRegisterAttribute = true;
            CanResolveNonAbstractTypesWithoutRegistration = true;

            // Register default implementations
            // TODO: Enable for CTL-272 
            //RegisterType(typeof(ICollection<>), typeof(Collection<>));
            //RegisterType(typeof(IEnumerable<>), typeof(List<>));
            //RegisterType(typeof(IList<>), typeof(List<>));
        }
コード例 #5
0
ファイル: ServiceLocator.cs プロジェクト: pars87/Catel
        /// <summary>
        /// Initializes a new instance of the <see cref="ServiceLocator"/> class.
        /// </summary>
        public ServiceLocator()
        {
            _typeFactory = new TypeFactory(this);
            _autoRegistrationManager = new ServiceLocatorAutoRegistrationManager(this);

            IgnoreRuntimeIncorrectUsageOfRegisterAttribute = true;
            AutomaticallyKeepContainersSynchronized = true;
            SupportDependencyInjection = true;
            CanResolveNonAbstractTypesWithoutRegistration = true;

#if !NETFX_CORE
#if !WINDOWS_PHONE
            RegisterExternalContainerHelper(new MefHelper());
            RegisterExternalContainerHelper(new UnityHelper());
            RegisterExternalContainerHelper(new WindsorHelper());
#endif

            RegisterExternalContainerHelper(new NinjectHelper());
#endif

            RegisterInstance(typeof(IServiceLocator), this);
            RegisterInstance(typeof(ITypeFactory), _typeFactory);
        }
コード例 #6
0
ファイル: ServiceLocator.cs プロジェクト: JaysonJG/Catel
        /// <summary>
        /// Initializes a new instance of the <see cref="ServiceLocator"/> class.
        /// </summary>
        public ServiceLocator()
        {
            // Must be registered first, already resolved by TypeFactory
            RegisterInstance(typeof(IServiceLocator), this);

            _autoRegistrationManager = new ServiceLocatorAutoRegistrationManager(this);

            IgnoreRuntimeIncorrectUsageOfRegisterAttribute = true;
            AutomaticallyKeepContainersSynchronized = true;
            SupportDependencyInjection = true;
            CanResolveNonAbstractTypesWithoutRegistration = true;

            // Register default implementations
            // TODO: Enable for CTL-272 
            //RegisterType(typeof(ICollection<>), typeof(Collection<>));
            //RegisterType(typeof(IEnumerable<>), typeof(List<>));
            //RegisterType(typeof(IList<>), typeof(List<>));
        }