Catel.IoC.ServiceLocator.ServiceLocator C# (CSharp) Method

ServiceLocator() public method

Initializes a new instance of the ServiceLocator class.
public ServiceLocator ( ) : System
return System
        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<>));
        }
        #endregion