private Type GetImplementationTypeThroughFactory(InjectionConsumerInfo consumer) { var context = new TypeFactoryContext(this.serviceType, consumer); Type implementationType = this.implementationTypeFactory(context); if (implementationType == null) { throw new InvalidOperationException(StringResources.FactoryReturnedNull(this.serviceType)); } if (implementationType.ContainsGenericParameters()) { throw new ActivationException( StringResources.TheTypeReturnedFromTheFactoryShouldNotBeOpenGeneric( this.serviceType, implementationType)); } Requires.FactoryReturnsATypeThatIsAssignableFromServiceType(this.serviceType, implementationType); return(implementationType); }
private Type GetImplementationTypeThroughFactory(InjectionConsumerInfo consumer) { var context = new TypeFactoryContext(this.serviceType, consumer); Type implementationType = this.implementationTypeFactory(context); if (implementationType == null) { throw new InvalidOperationException(StringResources.FactoryReturnedNull(this.serviceType)); } if (implementationType.ContainsGenericParameters()) { throw new ActivationException( StringResources.TheTypeReturnedFromTheFactoryShouldNotBeOpenGeneric( this.serviceType, implementationType)); } Requires.FactoryReturnsATypeThatIsAssignableFromServiceType(this.serviceType, implementationType); return implementationType; }