internal static IModelBinder GetBinderFromAttributes(Type type, Action <Type> errorAction) { AttributeList allAttrs = new AttributeList(TypeDescriptorHelper.Get(type).GetAttributes()); CustomModelBinderAttribute binder = allAttrs.SingleOfTypeDefaultOrError <Attribute, CustomModelBinderAttribute, Type>(errorAction, type); return(binder == null ? null : binder.GetBinder()); }
internal static IModelBinder GetBinderFromAttributes(Type type, Func <string> errorMessageAccessor) { AttributeCollection allAttrs = TypeDescriptorHelper.Get(type).GetAttributes(); CustomModelBinderAttribute[] filteredAttrs = allAttrs.OfType <CustomModelBinderAttribute>().ToArray(); return(GetBinderFromAttributesImpl(filteredAttrs, errorMessageAccessor)); }
protected virtual ICustomTypeDescriptor GetTypeDescriptor( ControllerContext controllerContext, ModelBindingContext bindingContext ) { return(TypeDescriptorHelper.Get(bindingContext.ModelType)); }
protected virtual ICustomTypeDescriptor GetTypeDescriptor(Type type) { return(TypeDescriptorHelper.Get(type)); }
protected virtual ICustomTypeDescriptor GetTypeDescriptor(Type type) => TypeDescriptorHelper.Get(type);