protected IComponentAdapter BuildComponentAdapter(RegisterWithContainerAttribute attribute, Type type) { IComponentAdapter result; if(attribute.DependencyInjection == DependencyInjectionType.Constructor) { result = BuildConstructorInjectionAdapter(attribute, type); } else { result = BuildSetterInjectionAdapter(attribute, type); } if(attribute.ComponentAdapterType == ComponentAdapterType.Caching) { result = new CachingComponentAdapter(result); } return result; }
private IComponentAdapter BuildCustomComponentAdapter(RegisterWithContainerAttribute attribute, Type type) { return (IComponentAdapter)Activator.CreateInstance(attribute.ComponentAdapter, new object[] {type}); }
private IComponentAdapter BuildConstructorInjectionAdapter(RegisterWithContainerAttribute attribute, Type type) { IParameter[] parameters = createParametersArray(type); if(attribute.Key == null) { if(parameters == null) { return new ConstructorInjectionComponentAdapter(type); } return new ConstructorInjectionComponentAdapter(type, type, parameters); } else if(parameters == null) { return new ConstructorInjectionComponentAdapter(attribute.Key, type); } return new ConstructorInjectionComponentAdapter(attribute.Key, type, parameters); }