1 /* ****************************************************************************
\r
3 * Copyright (c) Microsoft Corporation. All rights reserved.
\r
5 * This software is subject to the Microsoft Public License (Ms-PL).
\r
6 * A copy of the license can be found in the license.htm file included
\r
7 * in this distribution.
\r
9 * You must not remove this notice, or any other, from this software.
\r
11 * ***************************************************************************/
\r
13 namespace System.Web.Mvc {
\r
15 using System.Collections.Generic;
\r
16 using System.Collections.ObjectModel;
\r
17 using System.Globalization;
\r
18 using System.Reflection;
\r
19 using System.Web.Mvc.Resources;
\r
21 internal class ReflectedParameterBindingInfo : ParameterBindingInfo {
\r
23 private ICollection<string> _exclude = new string[0];
\r
24 private ICollection<string> _include = new string[0];
\r
25 private readonly ParameterInfo _parameterInfo;
\r
26 private string _prefix;
\r
28 public ReflectedParameterBindingInfo(ParameterInfo parameterInfo) {
\r
29 _parameterInfo = parameterInfo;
\r
30 ReadSettingsFromBindAttribute();
\r
33 public override IModelBinder Binder {
\r
35 IModelBinder binder = ModelBinders.GetBinderFromAttributes(_parameterInfo,
\r
36 () => String.Format(CultureInfo.CurrentUICulture, MvcResources.ReflectedParameterBindingInfo_MultipleConverterAttributes,
\r
37 _parameterInfo.Name, _parameterInfo.Member));
\r
43 public override ICollection<string> Exclude {
\r
49 public override ICollection<string> Include {
\r
55 public override string Prefix {
\r
61 private void ReadSettingsFromBindAttribute() {
\r
62 BindAttribute attr = (BindAttribute)Attribute.GetCustomAttribute(_parameterInfo, typeof(BindAttribute));
\r
67 _exclude = new ReadOnlyCollection<string>(AuthorizeAttribute.SplitString(attr.Exclude));
\r
68 _include = new ReadOnlyCollection<string>(AuthorizeAttribute.SplitString(attr.Include));
\r
69 _prefix = attr.Prefix;
\r