Ejemplo n.º 1
0
		private ComponentRegistration<object> InitializeCreationPolicy(IComponent component, ComponentRegistration componentFor)
		{
			if (component.Instance != null)
			{
				return componentFor.Instance(component.Instance);
			}
			if (component.Implementation != null)
			{
				return componentFor.ImplementedBy(component.Implementation);
			}
			if (component.Factory != null)
			{
				return componentFor.UsingFactoryMethod(a => component.Factory(this));
			}
			throw new ContainerException("Implementation not allowed for interface " + component.Interface);
		}