/// <summary>Initializes a new instance of the <see cref="InstanceProducer{TService}"/> class.</summary>
 /// <param name="registration">The <see cref="Registration"/>.</param>
 public InstanceProducer(Registration registration)
     : base(typeof(TService), registration)
 {
 }
示例#2
0
        private static InstanceProducer BuildInstanceProducerForConcreteUnregisteredType(Type concreteType,
                                                                                         Registration registration)
        {
            var producer = new InstanceProducer(concreteType, registration);

            producer.EnsureTypeWillBeExplicitlyVerified();

            // Flag that this producer is resolved by the container or using unregistered type resolution.
            producer.IsContainerAutoRegistered = true;

            return(producer);
        }
 internal InstanceProducer(
     Type serviceType, Registration registration, Predicate <PredicateContext> predicate)
     : this(serviceType, registration)
 {
     this.Predicate = predicate ?? Always;
 }
示例#4
0
 internal Action <object> GetInitializer(Type implementationType, Registration context)
 {
     return(this.GetInitializer <object>(implementationType, context));
 }
 /// <summary>Initializes a new instance of the <see cref="InstanceProducer"/> class.</summary>
 /// <param name="serviceType">The service type for which this instance is created.</param>
 /// <param name="registration">The <see cref="Registration"/>.</param>
 public InstanceProducer(Type serviceType, Registration registration)
     : this(serviceType, registration, ShouldBeRegisteredAsAnExternalProducer(registration))
 {
     Requires.ServiceIsAssignableFromImplementation(
         serviceType, registration.ImplementationType, nameof(serviceType));
 }