Ejemplo n.º 1
0
 public void SetConstructorSelector(IConstructorSelector selector)
 {
     if (selector != null)
     {
         ConstructorSelector = selector;
     }
 }
Ejemplo n.º 2
0
        public ModelDataAccessor(Type type,
                                 ConstructorParameterBinding.Factory constructorParameterBindingFactory, ObjectRepositorySerializerFactory repositorySerializerFactory,
                                 IConstructorSelector constructorSelector)
        {
            if (constructorParameterBindingFactory == null)
            {
                throw new ArgumentNullException(nameof(constructorParameterBindingFactory));
            }
            if (repositorySerializerFactory == null)
            {
                throw new ArgumentNullException(nameof(repositorySerializerFactory));
            }
            if (constructorSelector == null)
            {
                throw new ArgumentNullException(nameof(constructorSelector));
            }

            Type = type ?? throw new ArgumentNullException(nameof(type));

            _childProperties      = new Lazy <IImmutableList <ChildPropertyInfo> >(GetChildProperties);
            _modifiableProperties = new Lazy <IImmutableList <ModifiablePropertyInfo> >(GetModifiableProperties);
            _constructorBinding   = new Lazy <ConstructorParameterBinding>(() =>
            {
                var constructors = from c in Type.GetTypeInfo().GetConstructors()
                                   select constructorParameterBindingFactory(c);
                return(constructorSelector.SelectConstructorBinding(Type, constructors.ToArray()));
            });

            repositorySerializerFactory().ValidateSerializable(Type);
        }
Ejemplo n.º 3
0
        public override TImplementation Compose(IComponentComposer composer, bool throwOnUnknown,
                                                IConstructorSelector constructorSelector)
        {
            if (disposed)
            {
                throw new ObjectDisposedException(this.GetType().Name);
            }

            if (null == composer)
            {
                throw new ArgumentNullException(nameof(composer));
            }

            if (null == constructorSelector)
            {
                throw new ArgumentNullException(nameof(constructorSelector));
            }

            if (null == threadLocalInstance.Value)
            {
                threadLocalInstance.Value = (TImplementation)composer.ComposeUsingConstructor(typeof(TImplementation), throwOnUnknown, constructorSelector);
            }

            return(threadLocalInstance.Value);
        }
Ejemplo n.º 4
0
 private DefaultConfiguration(Container container)
 {
     _constructorSelector = new ConstructorSelector();
     _dependencyResolver = new DependencyResolver(this);
     _registrationStorage = new RegistrationStorage();
     _typeActivator = new ExpressionActivator(container, _constructorSelector);
 }
Ejemplo n.º 5
0
 private DefaultConfiguration(Container container)
 {
     _constructorSelector = new ConstructorSelector();
     _dependencyResolver  = new DependencyResolver(this);
     _registrationStorage = new RegistrationStorage();
     _typeActivator       = new ExpressionActivator(container, _constructorSelector);
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Create an activator for the provided type.
        /// </summary>
        /// <param name="implementationType">Type to activate.</param>
        /// <param name="constructorFinder">Constructor finder.</param>
        /// <param name="constructorSelector">Constructor selector.</param>
        /// <param name="configuredParameters">Parameters configured explicitly for this instance.</param>
        /// <param name="configuredProperties">Properties configured explicitly for this instance.</param>
        public ReflectionActivator(
            Type implementationType,
            IConstructorFinder constructorFinder,
            IConstructorSelector constructorSelector,
            IEnumerable <Parameter> configuredParameters,
            IEnumerable <Parameter> configuredProperties)
            : base(implementationType)
        {
            if (constructorFinder == null)
            {
                throw new ArgumentNullException(nameof(constructorFinder));
            }
            if (constructorSelector == null)
            {
                throw new ArgumentNullException(nameof(constructorSelector));
            }
            if (configuredParameters == null)
            {
                throw new ArgumentNullException(nameof(configuredParameters));
            }
            if (configuredProperties == null)
            {
                throw new ArgumentNullException(nameof(configuredProperties));
            }

            _implementationType   = implementationType;
            ConstructorFinder     = constructorFinder;
            ConstructorSelector   = constructorSelector;
            _configuredProperties = configuredProperties;

            _defaultParameters = configuredParameters.Concat(
                new Parameter[] { new AutowiringParameter(), new DefaultValueParameter() });
        }
Ejemplo n.º 7
0
        private void RegisterExplicitConstructor <TService, TImplementation>(Container container,
                                                                             IConstructorSelector selector)
        {
            var constructor = selector.GetConstructor(typeof(TImplementation));

            this.constructors[CreateKey(typeof(TService), typeof(TImplementation))] = constructor;
        }
Ejemplo n.º 8
0
        static Mocked()
        {
            var stubFactoryCollection = new StubFactoryCollection();
            var moqBuilderFactory     = new MoqBuilderFactory(stubFactoryCollection);

            stubFactoryCollection.Append(new EmptyStringFactory());
            stubFactoryCollection.Append(new DefaultDateFactory());
            stubFactoryCollection.Append(new DefaultPrimitiveTypeFactory());
            stubFactoryCollection.Append(new NullableFactory());
            stubFactoryCollection.Append(new InterfaceStubFactory(moqBuilderFactory));
            stubFactoryCollection.Append(new TypeWithSingleParameterlessConstructorFactory(moqBuilderFactory));
            stubFactoryCollection.Append(new TypeWithSingleConstructorFactory(moqBuilderFactory, stubFactoryCollection));

            DefaultStubFactory         = stubFactoryCollection;
            DefaultDependenciesFactory = new StubDependenciesFactory(stubFactoryCollection);

            DefaultInstanceFactory = new InstanceFactoryCollection(
                new ConcreteInstanceFactory(),
                new AbstractClassFactory(moqBuilderFactory)
                );

            DefaultConstructorSelector = new ConstructorSelectorCollection(
                new ParameterlessConstructorSelector(),
                new SingleConstructorSelector()
                );

            DefaultMockedInstanceFactory = new MockedInstanceFactory(
                DefaultConstructorSelector,
                DefaultDependenciesFactory,
                DefaultInstanceFactory
                );
        }
Ejemplo n.º 9
0
        public void Register <TConcrete>(IConstructorSelector selector)
            where TConcrete : class
        {
            this.RegisterExplicitConstructor <TConcrete, TConcrete>(this.container, selector);

            this.container.Register <TConcrete, TConcrete>();
        }
Ejemplo n.º 10
0
        public override TImplementation Compose(IComponentComposer composer, bool throwOnUnknown,
                                                IConstructorSelector constructorSelector)
        {
            if (disposed)
            {
                throw new ObjectDisposedException(this.GetType().Name);
            }

            if (null == composer)
            {
                throw new ArgumentNullException(nameof(composer));
            }

            if (null == constructorSelector)
            {
                throw new ArgumentNullException(nameof(constructorSelector));
            }

            if (!this.lazyInstance.IsValueCreated)
            {
                this.Composer            = composer;
                this.ThrowOnUnknown      = throwOnUnknown;
                this.ConstructorSelector = constructorSelector;
            }

            return(this.lazyInstance.Value);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ReflectionActivatorData"/> class.
        /// </summary>
        /// <param name="implementer">Type that will be activated.</param>
        public ReflectionActivatorData(Type implementer)
        {
            ImplementationType = implementer;

            _constructorFinder   = DefaultConstructorFinder;
            _constructorSelector = DefaultConstructorSelector;
        }
Ejemplo n.º 12
0
        public void RegisterSingle <TService, TImplementation>(IConstructorSelector selector)
            where TService : class
            where TImplementation : class, TService
        {
            this.RegisterExplicitConstructor <TService, TImplementation>(this.container, selector);

            this.container.RegisterSingle <TService, TImplementation>();
        }
Ejemplo n.º 13
0
        public void Register <TService, TImplementation>(IConstructorSelector selector, Lifestyle lifestyle)
            where TService : class
            where TImplementation : class, TService
        {
            this.RegisterExplicitConstructor <TImplementation>(selector);

            this.container.Register <TService, TImplementation>(lifestyle);
        }
Ejemplo n.º 14
0
 public ReflectionActivator(Type implementationType, IConstructorFinder constructorFinder, IConstructorSelector constructorSelector, IEnumerable <Parameter> configuredParameters, IEnumerable <Parameter> configuredProperties) : base(Enforce.ArgumentNotNull <Type>(implementationType, "implementationType"))
 {
     this._implementationType   = implementationType;
     this._constructorFinder    = Enforce.ArgumentNotNull <IConstructorFinder>(constructorFinder, "constructorFinder");
     this._constructorSelector  = Enforce.ArgumentNotNull <IConstructorSelector>(constructorSelector, "constructorSelector");
     this._configuredParameters = Enforce.ArgumentNotNull <IEnumerable <Parameter> >(configuredParameters, "configuredParameters");
     this._configuredProperties = Enforce.ArgumentNotNull <IEnumerable <Parameter> >(configuredProperties, "configuredProperties");
 }
Ejemplo n.º 15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ContainerOption"/> class.
 /// </summary>
 /// <param name="useLightweightCodeGeneration">if set to <c>true</c>, use lightweight code generation to create object instances.
 /// Otherwise, use the <see cref="System.Reflection"/> instead.</param>
 /// <param name="ctorSelector">The constructor selector used to select an eligible constructor based on the provided parameter type and position.</param>
 /// <param name="autoRegistrationPolicies">The auto registration policies.</param>
 private ContainerOption(bool useLightweightCodeGeneration, IConstructorSelector ctorSelector, params IAutoRegistrationPolicy[] autoRegistrationPolicies)
 {
     _useLightweightCodeGeneration = useLightweightCodeGeneration;
     _constructorSelector          = ctorSelector ?? new DefaultConstructorSelector(
         new BindingFlagsConstructorFinder(BindingFlags.Public),
         new AscendingConstructorSorter());
     _autoRegistrationPolicies = autoRegistrationPolicies;
 }
Ejemplo n.º 16
0
 public MockedInstanceFactory(
     IConstructorSelector constructorSelector,
     IDependenciesFactory dependenciesFactory,
     IInstanceFactory instanceFactory)
 {
     _dependenciesFactory = dependenciesFactory;
     _constructorSelector = constructorSelector;
     _instanceFactory     = instanceFactory;
 }
Ejemplo n.º 17
0
        // TODO: Add composition support using parameters that aren't in the container (Builder extension syntax).

        public T Compose <T>(bool throwOnUnknown         = true,
                             IComponentComposer composer = null,
                             IConstructorSelector constructorSelector = null)
        {
            if (this.disposed)
            {
                throw new ObjectDisposedException(this.GetType().Name);
            }

            return((T)this.Compose(typeof(T), throwOnUnknown, composer, constructorSelector));
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Ensures that there is a default for each option.
        /// </summary>
        public void EnsureDefaults()
        {
            if (DefaultLifecycle == null)
            {
                DefaultLifecycle = Lifecycle.Transient;
            }

            if (ConstructorSelector == null)
            {
                ConstructorSelector = new SinglePublicConstructorSelector();
            }
        }
Ejemplo n.º 19
0
 /// <summary>
 ///  Creates a new instance of the <see cref="ConfigurationOptions"/>
 ///  class.
 /// </summary>
 /// <param name="constructorSelector">
 ///  Indicates that unregistered types should be automatically resolved
 ///  where possible.
 /// </param>
 /// <param name="expressionBuilder">
 ///  The mechanism by which constructors are selected.
 /// </param>
 /// <param name="defaultLifecycle">
 ///  The default lifecycle to apply to unregistered types.
 /// </param>
 /// <param name="autoResolve">
 ///  true if we are to auto-resolve unregistered types, otherwise false.
 /// </param>
 public ConfigurationOptions(
     IConstructorSelector constructorSelector = null,
     IExpressionBuilder expressionBuilder     = null,
     ILifecycle defaultLifecycle = null,
     bool autoResolve            = false
     )
 {
     AutoResolve         = autoResolve;
     ConstructorSelector = constructorSelector ?? new DefaultConstructorSelector();
     DefaultLifecycle    = defaultLifecycle ?? Lifecycle.Default;
     ExpressionBuilder   = expressionBuilder ?? new ExpressionBuilder();
 }
Ejemplo n.º 20
0
        UsingConstructor <TLimit, TReflectionActivatorData, TStyle>(
            this IRegistrationBuilder <TLimit, TReflectionActivatorData, TStyle> registration,
            IConstructorSelector constructorSelector)
            where TReflectionActivatorData : ReflectionActivatorData
        {
            if (registration == null)
            {
                throw new ArgumentNullException(nameof(registration));
            }

            registration.ActivatorData.ConstructorSelector = constructorSelector ?? throw new ArgumentNullException(nameof(constructorSelector));
            return(registration);
        }
Ejemplo n.º 21
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TypeConstructionInfoBuilder"/> class.
 /// </summary>
 /// <param name="constructorSelector">The <see cref="IConstructorSelector"/> that is responsible
 /// for selecting the constructor to be used for constructor injection.</param>
 /// <param name="constructorDependencySelector">The <see cref="IConstructorDependencySelector"/> that is
 /// responsible for selecting the constructor dependencies for a given <see cref="ConstructionInfo"/>.</param>
 /// <param name="propertyDependencySelector">The <see cref="IPropertyDependencySelector"/> that is responsible
 /// for selecting the property dependencies for a given <see cref="Type"/>.</param>
 /// <param name="getConstructorDependencyExpression">A function delegate that returns the registered constructor dependency expression, if any.</param>
 /// <param name="getPropertyDependencyExpression">A function delegate that returns the registered property dependency expression, if any.</param>
 public TypeConstructionInfoBuilder(
     IConstructorSelector constructorSelector,
     IConstructorDependencySelector constructorDependencySelector,
     IPropertyDependencySelector propertyDependencySelector,
     Func <Type, string, Delegate> getConstructorDependencyExpression,
     Func <Type, string, Delegate> getPropertyDependencyExpression)
 {
     this.constructorSelector                = constructorSelector;
     this.constructorDependencySelector      = constructorDependencySelector;
     this.propertyDependencySelector         = propertyDependencySelector;
     this.getConstructorDependencyExpression = getConstructorDependencyExpression;
     this.getPropertyDependencyExpression    = getPropertyDependencyExpression;
 }
 /// <summary>
 /// Create an activator for the provided type.
 /// </summary>
 /// <param name="implementationType">Type to activate.</param>
 /// <param name="constructorFinder">Constructor finder.</param>
 /// <param name="constructorSelector">Constructor selector.</param>
 /// <param name="configuredParameters">Parameters configured explicitly for this instance.</param>
 /// <param name="configuredProperties">Properties configured explicitly for this instance.</param>
 public ReflectionActivator(
     Type implementationType,
     IConstructorFinder constructorFinder,
     IConstructorSelector constructorSelector,
     IEnumerable<Parameter> configuredParameters,
     IEnumerable<Parameter> configuredProperties)
     : base(Enforce.ArgumentNotNull(implementationType, "implementationType"))
 {
     _implementationType = implementationType;
     _constructorFinder = Enforce.ArgumentNotNull(constructorFinder, "constructorFinder");
     _constructorSelector = Enforce.ArgumentNotNull(constructorSelector, "constructorSelector");
     _configuredParameters = Enforce.ArgumentNotNull(configuredParameters, "configuredParameters");
     _configuredProperties = Enforce.ArgumentNotNull(configuredProperties, "configuredProperties");
 }
Ejemplo n.º 23
0
        public override void PrepareComposition(IComponentComposer composer, IConstructorSelector constructorSelector)
        {
            if (null == composer)
            {
                throw new ArgumentNullException(nameof(composer));
            }

            if (null == constructorSelector)
            {
                throw new ArgumentNullException(nameof(constructorSelector));
            }

            composer.PrepareToComposeUsingConstructor(typeof(TImplementation), constructorSelector);
        }
Ejemplo n.º 24
0
        public bool IsPreparedToComposeUsingConstructor(Type componentType, IConstructorSelector constructorSelector)
        {
            if (null == componentType)
            {
                throw new ArgumentNullException(nameof(componentType));
            }

            if (null == constructorSelector)
            {
                throw new ArgumentNullException(nameof(constructorSelector));
            }

            var activatorKey = Tuple.Create(componentType, constructorSelector.GetType());

            return(this.Activators.ContainsKey(activatorKey));
        }
Ejemplo n.º 25
0
        /// <summary>
        /// Create an activator for the provided type.
        /// </summary>
        /// <param name="implementationType">Type to activate.</param>
        /// <param name="constructorFinder">Constructor finder.</param>
        /// <param name="constructorSelector">Constructor selector.</param>
        /// <param name="configuredParameters">Parameters configured explicitly for this instance.</param>
        /// <param name="configuredProperties">Properties configured explicitly for this instance.</param>
        public ReflectionActivator(
            Type implementationType,
            IConstructorFinder constructorFinder,
            IConstructorSelector constructorSelector,
            IEnumerable <Parameter> configuredParameters,
            IEnumerable <Parameter> configuredProperties)
            : base(Enforce.ArgumentNotNull(implementationType, "implementationType"))
        {
            _implementationType   = implementationType;
            _constructorFinder    = Enforce.ArgumentNotNull(constructorFinder, "constructorFinder");
            _constructorSelector  = Enforce.ArgumentNotNull(constructorSelector, "constructorSelector");
            _configuredParameters = Enforce.ArgumentNotNull(configuredParameters, "configuredParameters");
            _configuredProperties = Enforce.ArgumentNotNull(configuredProperties, "configuredProperties");

            _defaultParameters = _configuredParameters.Concat(
                new Parameter[] { new AutowiringParameter(), new DefaultValueParameter() });
        }
Ejemplo n.º 26
0
        /// <summary>
        /// Create an activator for the provided type.
        /// </summary>
        /// <param name="implementationType">Type to activate.</param>
        /// <param name="constructorFinder">Constructor finder.</param>
        /// <param name="constructorSelector">Constructor selector.</param>
        /// <param name="configuredParameters">Parameters configured explicitly for this instance.</param>
        /// <param name="configuredProperties">Properties configured explicitly for this instance.</param>
        public ReflectionActivator(
            Type implementationType,
            IConstructorFinder constructorFinder,
            IConstructorSelector constructorSelector,
            IEnumerable<Parameter> configuredParameters,
            IEnumerable<Parameter> configuredProperties)
            : base(Enforce.ArgumentNotNull(implementationType, "implementationType"))
        {
            _implementationType = implementationType;
            _constructorFinder = Enforce.ArgumentNotNull(constructorFinder, "constructorFinder");
            _constructorSelector = Enforce.ArgumentNotNull(constructorSelector, "constructorSelector");
            _configuredParameters = Enforce.ArgumentNotNull(configuredParameters, "configuredParameters");
            _configuredProperties = Enforce.ArgumentNotNull(configuredProperties, "configuredProperties");

            _defaultParameters = _configuredParameters.Concat(
                new Parameter[] {new AutowiringParameter(), new DefaultValueParameter()});
        }
Ejemplo n.º 27
0
        public InstanceActivator(IInstanceActivator activator)
        {
            this.activator = activator;
            var reflectionActivator = activator as ReflectionActivator;

            if (reflectionActivator != null)
            {
                this.constructorFinder   = reflectionActivator.ConstructorFinder;
                this.constructorSelector = reflectionActivator.ConstructorSelector;
                this._defaultParameters  = (IEnumerable <Parameter>)_defaultParametersField.GetValue(reflectionActivator);
            }
            else
            {
                this.constructorFinder   = new DefaultConstructorFinder();
                this.constructorSelector = new MostParametersConstructorSelector();
                this._defaultParameters  = new Parameter[] { new AutowiringParameter(), new DefaultValueParameter() };
            }
        }
Ejemplo n.º 28
0
        public virtual void PrepareToComposeUsingConstructor(Type componentType, IConstructorSelector constructorSelector)
        {
            if (null == componentType)
            {
                throw new ArgumentNullException(nameof(componentType));
            }

            if (null == constructorSelector)
            {
                throw new ArgumentNullException(nameof(constructorSelector));
            }

            var selectedConstructorInfo = this.DefaultConstructorSelector.SelectConstructor(componentType);
            var activatorKey            = Tuple.Create(componentType, constructorSelector.GetType());

            this.Activators.Add(activatorKey,
                                (throwOnUnknown) => this.ComposeUsingConstructor(throwOnUnknown, selectedConstructorInfo, constructorSelector));
        }
Ejemplo n.º 29
0
        public object Compose(Type componentType,
                              bool throwOnUnknown         = true,
                              IComponentComposer composer = null,
                              IConstructorSelector constructorSelector = null)
        {
            if (this.disposed)
            {
                throw new ObjectDisposedException(this.GetType().Name);
            }

            if (null == componentType)
            {
                throw new ArgumentNullException(nameof(componentType));
            }

            var component = this.GetRegisteredComponent(componentType);

            switch (component)
            {
            case null when componentType.IsInterface && !throwOnUnknown:
                return(null);

            case null when componentType.IsInterface && throwOnUnknown:
                throw new ArgumentException($"Failed to compose '{componentType.FullName}', no matching component registration was found. Did you forget to register a component?", nameof(componentType));

            case null when componentType.IsAbstract && !throwOnUnknown:
                return(null);

            case null when componentType.IsAbstract && throwOnUnknown:
                throw new ArgumentException($"Failed to compose '{componentType.FullName}', no matching component registration was found and the requested type can not be constructed because it is abstract.", nameof(componentType));

            case null:
                return((composer ?? this.DefaultComposer).ComposeUsingConstructor(
                           componentType, throwOnUnknown, constructorSelector ?? this.DefaultConstructorSelector));
            }

            if (component.InstanceType.IsAbstract)
            {
                throw new ArgumentException($"Failed to compose '{componentType.FullName}', no matching component registration was found and the requested type can not be constructed because it is abstract. There may be a bug in your { nameof(IContainerComponent) }.", nameof(componentType));
            }

            return(component.Compose(composer ?? this.DefaultComposer, throwOnUnknown,
                                     constructorSelector ?? this.DefaultConstructorSelector));
        }
Ejemplo n.º 30
0
        public AutoMocker(IConstructorSelector constructorSelector, IProxyFactory proxyFactory)
        {
            if (constructorSelector == null)
            {
                throw new ArgumentNullException("constructorSelector");
            }
            if (proxyFactory == null)
            {
                throw new ArgumentNullException("proxyFactory");
            }

            _proxyFactory = proxyFactory;

            ConstructorInfo ctor = constructorSelector.Select(typeof(TClass));

            _parameters = ctor
                          .GetParameters()
                          .ToDictionary(pi => pi.ParameterType, pi => (object)null);

            _classUnderTest = new Lazy <TClass>(() => CreateInstance(ctor));
        }
Ejemplo n.º 31
0
        /// <summary>
        /// Create an activator for the provided type.
        /// </summary>
        /// <param name="implementationType">Type to activate.</param>
        /// <param name="constructorFinder">Constructor finder.</param>
        /// <param name="constructorSelector">Constructor selector.</param>
        /// <param name="configuredParameters">Parameters configured explicitly for this instance.</param>
        /// <param name="configuredProperties">Properties configured explicitly for this instance.</param>
        public ReflectionActivator(
            Type implementationType,
            IConstructorFinder constructorFinder,
            IConstructorSelector constructorSelector,
            IEnumerable<Parameter> configuredParameters,
            IEnumerable<Parameter> configuredProperties)
            : base(implementationType)
        {
            if (constructorFinder == null) throw new ArgumentNullException(nameof(constructorFinder));
            if (constructorSelector == null) throw new ArgumentNullException(nameof(constructorSelector));
            if (configuredParameters == null) throw new ArgumentNullException(nameof(configuredParameters));
            if (configuredProperties == null) throw new ArgumentNullException(nameof(configuredProperties));

            _implementationType = implementationType;
            ConstructorFinder = constructorFinder;
            ConstructorSelector = constructorSelector;
            _configuredProperties = configuredProperties;

            _defaultParameters = configuredParameters.Concat(
                new Parameter[] {new AutowiringParameter(), new DefaultValueParameter()});
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="CachedConstructorSelector"/> class.
 /// </summary>
 /// <param name="constructorSelector">
 /// The <see cref="IConstructorSelector"/> being decorated.
 /// </param>
 public CachedConstructorSelector(IConstructorSelector constructorSelector)
 {
     this.constructorSelector = constructorSelector;
 }
Ejemplo n.º 33
0
 public FormatterServicesActivator(Container container, IConstructorSelector constructorSelector)
     : base(container, constructorSelector)
 {
     _constructorSelector = constructorSelector;
     _container = container;
 }
Ejemplo n.º 34
0
 public ExpressionActivator(Container container, IConstructorSelector constructorSelector)
 {
     _constructorSelector = constructorSelector;
     _container = container;
 }
Ejemplo n.º 35
0
 public ProxyActivator(IConstructorSelector constructorSelector)
 {
     _constructorSelector = constructorSelector;
 }
Ejemplo n.º 36
0
 public void Add(IConstructorSelector selector)
 {
     _selectors.Add(selector);
 }
Ejemplo n.º 37
0
 ///<summary>
 /// Creates a new instance of <see cref="ReflectionActivator" />.
 ///</summary>
 ///<param name="implementationType">The implementation type.</param>
 ///<param name="constructorSelector">The constructor selector.</param>
 ///<param name="argumentCollector">The argument collector.</param>
 internal ReflectionActivator(Type implementationType, IConstructorSelector constructorSelector, IArgumentCollector argumentCollector)
 {
     this._implementationType = implementationType;
     this._constructorSelector = constructorSelector;
     this._argumentCollector = argumentCollector;
 }
Ejemplo n.º 38
0
 object IContainerComponent.Compose(IComponentComposer composer,
                                    bool throwOnUnknown, IConstructorSelector constructorSelector)
 {
     return(this.Compose(composer, throwOnUnknown, constructorSelector));
 }
Ejemplo n.º 39
0
 public virtual void PrepareComposition(IComponentComposer composer, IConstructorSelector constructorSelector)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 40
0
 public abstract TComponent Compose(IComponentComposer composer, bool throwOnUnknown, IConstructorSelector constructorSelector);
 /// <summary>
 /// Initializes a new instance of the <see cref="ConstructorExpressionGenerator"/> class.
 /// </summary>
 /// <param name="selector">
 /// The selector.
 /// </param>
 public ConstructorExpressionGenerator(IConstructorSelector selector)
 {
     this.selector = selector;
 }
Ejemplo n.º 42
0
 IConfigurable IConfigurable.SetConstructorSelector(IConstructorSelector constructorSelector)
 {
     _constructorSelector = constructorSelector;
     return this;
 }
Ejemplo n.º 43
0
 public DefaultTypeActivator(Container container, IConstructorSelector constructorSelector)
 {
     _constructorSelector = constructorSelector;
     _container = container;
 }