public FromBinderGeneric( DiContainer bindContainer, BindInfo bindInfo, BindStatement bindStatement) : base(bindContainer, bindInfo, bindStatement) { BindingUtil.AssertIsDerivedFromTypes(typeof(TContract), BindInfo.ContractTypes); }
public FromBinderNonGeneric To(IEnumerable <Type> concreteTypes) { BindingUtil.AssertIsDerivedFromTypes( concreteTypes, BindInfo.ContractTypes, BindInfo.InvalidBindResponse); BindInfo.ToChoice = ToChoices.Concrete; BindInfo.ToTypes.Clear(); BindInfo.ToTypes.AddRange(concreteTypes); return(new FromBinderNonGeneric( BindContainer, BindInfo, BindStatement)); }
protected ScopeConcreteIdArgConditionCopyNonLazyBinder FromMethodBase <TConcrete>(Func <InjectContext, TConcrete> method) { BindingUtil.AssertIsDerivedFromTypes(typeof(TConcrete), AllParentTypes); BindInfo.RequireExplicitScope = false; // Don't know how it's created so can't assume here that it violates AsSingle BindInfo.MarkAsCreationBinding = false; SubFinalizer = new ScopableBindingFinalizer( BindInfo, (container, type) => new MethodProvider <TConcrete>(method, container)); return(this); }
protected ScopeConcreteIdArgConditionCopyNonLazyBinder FromResolveGetterBase <TObj, TResult>( object identifier, Func <TObj, TResult> method, InjectSources source, bool matchMultiple) { BindingUtil.AssertIsDerivedFromTypes(typeof(TResult), AllParentTypes); BindInfo.RequireExplicitScope = false; // Don't know how it's created so can't assume here that it violates AsSingle BindInfo.MarkAsCreationBinding = false; SubFinalizer = new ScopableBindingFinalizer( BindInfo, (container, type) => new GetterProvider <TObj, TResult>(identifier, method, container, source, matchMultiple)); return(new ScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo)); }
public FromBinderNonGeneric To(IEnumerable <Type> concreteTypes) { BindInfo.ToChoice = ToChoices.Concrete; BindInfo.ToTypes.Clear(); BindInfo.ToTypes.AddRange(concreteTypes); if (BindInfo.ToTypes.Count > 1 && BindInfo.ContractTypes.Count > 1) { // Be more lenient in this case to behave similar to convention based bindings BindInfo.InvalidBindResponse = InvalidBindResponses.Skip; } else { BindingUtil.AssertIsDerivedFromTypes(concreteTypes, BindInfo.ContractTypes, BindInfo.InvalidBindResponse); } return(this); }
public ScopeConcreteIdArgConditionCopyNonLazyBinder FromMethodMultiple <TConcrete>(Func <InjectContext, IEnumerable <TConcrete> > method) { BindingUtil.AssertIsDerivedFromTypes(typeof(TConcrete), AllParentTypes); return(FromMethodMultipleBase <TConcrete>(method)); }