Esempio n. 1
0
        private void ReadSettingsFromBindAttribute()
        {
            BindAttribute bindAttribute = (BindAttribute)Attribute.GetCustomAttribute(this._parameterInfo, typeof(BindAttribute));

            if (bindAttribute == null)
            {
                return;
            }
            this._exclude = new ReadOnlyCollection <string>(bindAttribute.Exclude.SplitTrim(StringExtensions.CommaSeparatorArray));
            this._include = new ReadOnlyCollection <string>(bindAttribute.Include.SplitTrim(StringExtensions.CommaSeparatorArray));
            this._prefix  = bindAttribute.Prefix;
        }
Esempio n. 2
0
        /// <summary>
        /// 属性筛选器
        /// </summary>
        /// <param name="parameterDescriptor"></param>
        /// <returns></returns>
        internal static Predicate <string> GetPropertyFilter(ParameterDescriptor parameterDescriptor)
        {
            ParameterBindingInfo bindingInfo = parameterDescriptor.BindingInfo;

            return((string propertyName) => BindAttribute.IsPropertyAllowed(propertyName, bindingInfo.Include.ToArray <string>(), bindingInfo.Exclude.ToArray <string>()));
        }
Esempio n. 3
0
 public bool IsPropertyAllowed(string propertyName)
 {
     return(BindAttribute.IsPropertyAllowed(propertyName, this._includeSplit, this._excludeSplit));
 }