public IEnumerable <IBinding> Handle(IComponentContainer components, IBindingTable table, Type type) { if (type.GetCustomAttribute <DaoAttribute>() != null) { return(new[] { new Binding(type, new CallbackProvider(type, kernel => kernel.Get <IAccessorFactory>().Create(type))) }); } return(Enumerable.Empty <IBinding>()); }
/// <summary> /// /// </summary> /// <param name="components"></param> /// <param name="table"></param> /// <param name="type"></param> /// <returns></returns> public IEnumerable <IBinding> Handle(IComponentContainer components, IBindingTable table, Type type) { if (type.IsInterface || type.IsAbstract || type.IsValueType || (type == StringType) || type.ContainsGenericParameters) { return(Enumerable.Empty <IBinding>()); } return(new[] { new Binding(type, new StandardProvider(type, components)) }); }
/// <summary> /// /// </summary> /// <param name="components"></param> /// <param name="table"></param> /// <param name="type"></param> /// <returns></returns> public IEnumerable <IBinding> Handle(IComponentContainer components, IBindingTable table, Type type) { if (!type.IsGenericType) { return(Enumerable.Empty <IBinding>()); } return(table.FindBindings(type.GetGenericTypeDefinition()) .Select(b => (IBinding) new Binding( type, new StandardProvider(b.Provider.TargetType.MakeGenericType(type.GetGenericArguments()), components), b.Scope, b.Metadata, b.ConstructorArguments, b.PropertyValues))); }