Пример #1
0
 protected virtual IModelBinder GetBinder(ParameterDescriptor parameter)
 {
     return parameter.Binding.Binder ?? Binders.GetBinder(parameter.Type);
 }
Пример #2
0
        protected virtual object GetParameterValue(ControllerContext context, 
            ParameterDescriptor parameter)
        {
            Precondition.Require(context, () => Error.ArgumentNull("context"));
            Precondition.Require(parameter, () => Error.ArgumentNull("parameter"));

            IModelBinder binder = GetBinder(parameter);
            BindingContext bc = new BindingContext(context, parameter.Type, 
                parameter.Binding.Name, GetValueProvider(context, parameter.Binding.Source), 
				GetController().ModelState);
            bc.FallbackToEmptyPrefix = (String.Equals(parameter.Binding.Name, parameter.Name));

            return binder.Bind(bc) ?? parameter.Binding.DefaultValue;
        }
Пример #3
0
 protected virtual IModelBinder GetBinder(ParameterDescriptor parameter)
 {
     return(parameter.Binding.Binder ?? Binders.GetBinder(parameter.Type));
 }