public FromBinderGeneric( BindInfo bindInfo, BindFinalizerWrapper finalizerWrapper) : base(bindInfo, finalizerWrapper) { BindingUtil.AssertIsDerivedFromTypes(typeof(TContract), BindInfo.ContractTypes); }
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 = concreteTypes.ToList(); return(this); }
public FromBinderNonGeneric To(IEnumerable <Type> concreteTypes) { BindingUtil.AssertIsDerivedFromTypes(concreteTypes, BindInfo.ContractTypes); BindInfo.ToChoice = ToChoices.Concrete; BindInfo.ToTypes = concreteTypes.ToList(); return(new FromBinderNonGeneric( BindInfo, FinalizerWrapper)); }
protected ScopeArgBinder FromMethodBase <TConcrete>(Func <InjectContext, TConcrete> method) { BindingUtil.AssertIsDerivedFromTypes(typeof(TConcrete), AllParentTypes); SubFinalizer = new ScopableBindingFinalizer( BindInfo, SingletonTypes.ToMethod, new SingletonImplIds.ToMethod(method), (container, type) => new MethodProvider <TConcrete>(method, container)); return(this); }
protected ScopeArgBinder FromFactoryBase <TConcrete, TFactory>() where TFactory : IFactory <TConcrete> { BindingUtil.AssertIsDerivedFromTypes(typeof(TConcrete), AllParentTypes); SubFinalizer = new ScopableBindingFinalizer( BindInfo, SingletonTypes.ToFactory, typeof(TFactory), (container, type) => new FactoryProvider <TConcrete, TFactory>(container, BindInfo.Arguments)); return(new ScopeArgBinder(BindInfo)); }
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 ScopeArgConditionCopyNonLazyBinder FromMethodMultipleBase <TConcrete>(Func <InjectContext, IEnumerable <TConcrete> > method) { BindingUtil.AssertIsDerivedFromTypes(typeof(TConcrete), AllParentTypes); BindInfo.RequireExplicitScope = false; SubFinalizer = new ScopableBindingFinalizer( BindInfo, SingletonTypes.FromMethod, new SingletonImplIds.ToMethod(method), (container, type) => new MethodProviderMultiple <TConcrete>(method, container)); return(this); }
protected ScopeBinder FromResolveGetterBase <TObj, TResult>( object identifier, Func <TObj, TResult> method) { BindingUtil.AssertIsDerivedFromTypes(typeof(TResult), AllParentTypes); SubFinalizer = new ScopableBindingFinalizer( BindInfo, SingletonTypes.ToGetter, new SingletonImplIds.ToGetter(identifier, method), (container, type) => new GetterProvider <TObj, TResult>(identifier, method, container)); return(new ScopeBinder(BindInfo)); }
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)); }
protected ScopeArgConditionCopyNonLazyBinder FromFactoryBase <TConcrete, TFactory>() where TFactory : IFactory <TConcrete> { BindingUtil.AssertIsDerivedFromTypes(typeof(TConcrete), AllParentTypes); // This is kind of like a look up method like FromMethod so don't enforce specifying scope BindInfo.RequireExplicitScope = false; SubFinalizer = new ScopableBindingFinalizer( BindInfo, SingletonTypes.FromFactory, typeof(TFactory), (container, type) => new FactoryProvider <TConcrete, TFactory>(container, BindInfo.Arguments)); return(new ScopeArgConditionCopyNonLazyBinder(BindInfo)); }
public FromBinderNonGeneric To(IEnumerable <Type> concreteTypes) { BindInfo.ToChoice = ToChoices.Concrete; BindInfo.ToTypes = concreteTypes.ToList(); 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(Func <InjectContext, IEnumerable <TContract> > method) { BindingUtil.AssertIsDerivedFromTypes(typeof(TContract), AllParentTypes); return(FromMethodMultipleBase <TContract>(method)); }