public ServiceLocator(IContainerConfiguration containerConfiguration)
        {
            var assembliesProvider      = new AssembliesProvider(containerConfiguration);
            var compositionRootProvider = new CompositionRootProvider(assembliesProvider);
            var registry      = new Registry();
            var typesProvider = new TypesProvider();
            var objectInstantiatingGenerator            = new ObjectInstantiatingGenerator();
            var intantiationProvidingGeneratingStrategy = new InstantiationProvidingGeneratingStrategy(objectInstantiatingGenerator);
            var scopeKeeper = new ScopeKeeper();
            var perRequestProvidingGeneratingStrategy   = new PerRequestProvidingGeneratingStrategy(scopeKeeper, objectInstantiatingGenerator);
            var perContainerProvidingGeneratingStrategy = new PerContainerProvidingGeneratingStrategy(scopeKeeper, objectInstantiatingGenerator);
            var arrayInstantiatingGenerator             = new ArrayInstantiatingGenerator();
            var enumerableProvidingGeneratingStrategy   = new EnumerableProvidingGeneratingStrategy(arrayInstantiatingGenerator);
            var generatingStrategyProvider           = new GeneratingStrategyProvider(intantiationProvidingGeneratingStrategy, perRequestProvidingGeneratingStrategy, perContainerProvidingGeneratingStrategy, enumerableProvidingGeneratingStrategy);
            var objectGraphProvider                  = new ObjectGraphProvider(registry, generatingStrategyProvider);
            var instanceProvidingMethodBodyGenerator = new InstanceProvidingMethodBodyGenerator();
            var instanceProvidingMethodGenerator     = new InstanceProvidingMethodGenerator(objectGraphProvider, instanceProvidingMethodBodyGenerator);
            var registrationFactory                  = new RegistrationFactory(typesProvider, instanceProvidingMethodGenerator);
            var assemblyBoundedRegistrator           = new AssemblyBoundedRegistrator(registry, registrationFactory);
            var registratorProvider                  = new RegistratorProvider(assemblyBoundedRegistrator);
            var dependenciesCompositor               = new DependenciesCompositor(compositionRootProvider, registratorProvider);
            var registrySaturator   = new RegistrySaturator(registry, scopeKeeper);
            var registryInitializer = new RegistryInitializer(dependenciesCompositor, registrySaturator);

            _map.Add(typeof(IRegistryInitializer), registryInitializer);
            _map.Add(typeof(IScopeKeeper), scopeKeeper);
            var resolver = new Resolver(registry, scopeKeeper);

            _map.Add(typeof(IResolver), resolver);
        }
Esempio n. 2
0
        public void Setup()
        {
            RegistryInitializer.Init <TestRegistry1, TestDef>(true);
            RegistryInitializer.Init <TestRegistry2, TestDef>(true);
            RegistryInitializer.Init <TestRegistry3, TestDef>(true);
            RegistryInitializer.Init <TestRegistry4, TestDef>(true);
            RegistryInitializer.Init <TestRegistry5, TestDef>(true);
            RegistryInitializer.Init <TestRegistry6, TestDef>(true);
            RegistryInitializer.Init <TestRegistry7, TestDef>(true);
            RegistryInitializer.Init <TestRegistry8, TestDef>(true);
            RegistryInitializer.Init <TestRegistry9, TestDef>(true);
            RegistryInitializer.Init <TestRegistry10, TestDef>(true);

            MetaRegistry.InitAll();
        }