/// <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<>)); }
/// <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<>)); }
/// <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); }