private ParameterBindingAttribute FindParameterBindingAttribute() { // Can be on parameter itself or on the parameter's type. Nearest wins. return(ChooseAttribute(GetCustomAttributes <ParameterBindingAttribute>()) ?? ChooseAttribute( ParameterType.GetCustomAttributes <ParameterBindingAttribute>(false) )); }
private ParameterBindingAttribute FindAttribute() { /* * 1.参数本身 * 2.参数目标类型 */ return(ChooseAttribute(ParameterInfo.GetCustomAttributes <ParameterBindingAttribute>().ToArray()) ?? ChooseAttribute(ParameterType.GetCustomAttributes <ParameterBindingAttribute>().ToArray())); }
private ModelBinderAttribute FindModelBinderAttribute() { // Can be on parameter itself or on the parameter's type. Nearest wins. return(GetCustomAttributes <ModelBinderAttribute>().SingleOrDefault() ?? ParameterType.GetCustomAttributes <ModelBinderAttribute>(false).SingleOrDefault()); }