Пример #1
0
 internal PredicateContext(Type serviceType, Func<Type> implementationTypeProvider,
     InjectionConsumerInfo consumer, bool handled)
 {
     this.ServiceType = serviceType;
     this.implementationTypeProvider = implementationTypeProvider;
     this.Consumer = consumer;
     this.Handled = handled;
 }
 internal PredicateContext(Type serviceType, Type implementationType, InjectionConsumerInfo consumer,
     bool handled)
 {
     this.ServiceType = serviceType;
     this.ImplementationType = implementationType;
     this.Consumer = consumer;
     this.Handled = handled;
 }
Пример #3
0
 public Expression BuildExpression(InjectionConsumerInfo consumer)
 {
     var localDataStoreSlot = Thread.GetNamedDataSlot(Consts.ModelParameterName);
     var model = Thread.GetData(localDataStoreSlot);
     return Expression.Constant(model, _modelType);
     //var lambda =
     //    Expression.Lambda<Func<object>>(
     //        Expression.Constant(Thread.GetData(Thread.GetNamedDataSlot(Consts.ModelParameterName)), _modelType));
     //return lambda;
 }
 internal TypeFactoryContext(Type serviceType, InjectionConsumerInfo consumer)
 {
     this.ServiceType = serviceType;
     this.Consumer = consumer;
 }
Пример #5
0
        internal Expression BuildParameterExpression(Type serviceType, Type implementationType, 
            ParameterInfo parameter)
        {
            var consumer = new InjectionConsumerInfo(serviceType, implementationType, parameter);

            Expression expression = this.DependencyInjectionBehavior.BuildExpression(consumer);

            // Expression will only be null if a user created a custom IConstructorInjectionBehavior that
            // returned null.
            if (expression == null)
            {
                throw new ActivationException(StringResources.DependencyInjectionBehaviorReturnedNull(
                    this.DependencyInjectionBehavior));
            }

            return expression;
        }
Пример #6
0
 internal PredicateContext(InstanceProducer producer, InjectionConsumerInfo consumer, bool handled)
     : this(producer.ServiceType, producer.Registration.ImplementationType, consumer, handled)
 {
 }
Пример #7
0
 private InstanceProducer?BuildInstanceProducerForType <TService>(InjectionConsumerInfo context)
     where TService : class
 {
     return(this.BuildInstanceProducerForType(typeof(TService),
                                              () => this.TryBuildInstanceProducerForConcreteUnregisteredType <TService>(context)));
 }
Пример #8
0
 private InstanceProducer?GetInstanceProducerForType(Type serviceType, InjectionConsumerInfo context)
 {
     return(this.GetInstanceProducerForType(
                serviceType, context, () => this.BuildInstanceProducerForType(serviceType, context)));
 }