public CompositeContainerContext(IContainerConfiguration configuration, IClassWrapperCreator classWrapperCreator,
                                         IContainerSelector containerSelector)
        {
            this.Configuration  = configuration;
            ClassWrapperCreator = classWrapperCreator;
            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, typesHelper);

            ImplementationCache              = new ImplementationCache();
            abstractionsCollection           = new AbstractionsCollection(implementationTypesCollection, ImplementationCache);
            ImplementationConfigurationCache = new ImplementationConfigurationCache();
            var factory = new AutoAbstractionConfigurationFactory(typesHelper, abstractionsCollection,
                                                                  ImplementationConfigurationCache);

            compositeCollection = new CompositeCollection(new[] { new AbstractionConfigurationCollection(factory) },
                                                          containerSelector);
            compositeCollection.Add(typeof(IContainer),
                                    new StupidAbstractionConfiguration(
                                        new ContainerImplementationConfiguration()));
        }
        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()));
        }
 public override void SetUp()
 {
     base.SetUp();
     typesHelperMock                      = GetMock <ITypesHelper>();
     abstractionsCollectionMock           = GetMock <IAbstractionsCollection>();
     implementationConfigurationCacheMock = GetMock <IImplementationConfigurationCache>();
     factory = new AutoAbstractionConfigurationFactory(typesHelperMock.Object, abstractionsCollectionMock.Object, implementationConfigurationCacheMock.Object);
 }
 public override void SetUp()
 {
     base.SetUp();
     typesHelper                      = NewMock <ITypesHelper>();
     abstractionsCollection           = GetMock <IAbstractionsCollection>();
     implementationConfigurationCache = GetMock <IImplementationConfigurationCache>();
     factory = new AutoAbstractionConfigurationFactory(typesHelper, abstractionsCollection,
                                                       implementationConfigurationCache);
 }
示例#5
0
        private CompositeContainerContext(CompositeContainerContext source)
        {
            Configuration   = source.Configuration;
            typesHelper     = source.typesHelper;
            FuncBuilder     = source.FuncBuilder;
            CreationContext = source.CreationContext;

            //NOTE чтобы дочерние контейнеры не тормозили, используем ту же AbstractionsCollection
            abstractionsCollection = source.abstractionsCollection;
            ImplementationCache    = source.ImplementationCache;

            ImplementationConfigurationCache = new ImplementationConfigurationCache();
            var factory = new AutoAbstractionConfigurationFactory(typesHelper, abstractionsCollection, ImplementationConfigurationCache);
            //NOTE для каждого экземпляра контейнера должна быть своя AbstractionConfigurationCollection
            var abstractionConfigurationCollection = new AbstractionConfigurationCollection(factory);

            compositeCollection = source.compositeCollection.MakeChildCollection(abstractionConfigurationCollection);
            compositeCollection.Add(typeof(IContainer), new StupidAbstractionConfiguration(new ContainerImplementationConfiguration()));
        }