private string GetCultureCode(ActionContext context)
        {
            IValueProvider provider = Configuration.Instance.Models
                                      .ValueProviders.GetProvider(context.Context,
                                                                  ParameterSource.FromString(Source));

            ValueProviderResult result = provider.GetValue(_parameterName);

            return((result == null) ? null : result.GetValue <string>());
        }
Ejemplo n.º 2
0
        private void InitFromAttributes()
        {
            _binder = GetModelBinder(_parameter);
            _source = ParameterSource.Default;

            BindAttribute attribute = (BindAttribute)Attribute.GetCustomAttribute(_parameter, typeof(BindAttribute));

            if (attribute != null)
            {
                _name         = attribute.Name ?? _parameter.Name;
                _source       = ParameterSource.FromString(attribute.Source);
                _defaultValue = attribute.Default;
            }
        }