Пример #1
0
        public ContainerContext(IContainerConfiguration configuration, IClassWrapperCreator classWrapperCreator)
        {
            Configuration       = configuration;
            ClassWrapperCreator = classWrapperCreator;
            ITypesHelper typesHelper = new TypesHelper();

            var funcHelper = new FuncHelper();

            FuncBuilder = new FuncBuilder();
            var classCreator        = new ClassCreator(funcHelper);
            var constructorSelector = new ConstructorSelector();

            CreationContext = new CreationContext(classCreator, constructorSelector, classWrapperCreator);

            var implementationTypesCollection = new ImplementationTypesCollection(configuration.GetTypesToScan(), typesHelper);

            ImplementationCache = new ImplementationCache();
            IAbstractionsCollection abstractionsCollection = new AbstractionsCollection(implementationTypesCollection, ImplementationCache);

            ImplementationConfigurationCache = new ImplementationConfigurationCache(); //l
            var factory = new AutoAbstractionConfigurationFactory(typesHelper, abstractionsCollection, ImplementationConfigurationCache);

            AbstractionConfigurationCollection = new AbstractionConfigurationCollection(factory);
            AbstractionConfigurationCollection.Add(typeof(IContainer), new StupidAbstractionConfiguration(new ContainerImplementationConfiguration()));
        }