让asp.net mvc的Action支持jQuery直接提交的javascript对象(2)
来源:未知 责任编辑:责任编辑 发表时间:2014-05-26 11:00 点击:次
internal interface IUnvalidatedRequestValues
{
NameValueCollection Form { get; }
NameValueCollection QueryString {get;}
string this[string key]{ get; }
}
internal delegate IUnvalidatedRequestValues UnvalidatedRequestValuesAccessor(ControllerContext controllerContext);
internal sealed class UnvalidatedRequestValuesWrapper : IUnvalidatedRequestValues
{
private readonly UnvalidatedRequestValues _unvalidatedValues;
public NameValueCollection Form
{
get
{
return this._unvalidatedValues.Form;
}
}
public NameValueCollection QueryString
{
get
{
return this._unvalidatedValues.QueryString;
}
}
public string this[string key]
{
get
{
return this._unvalidatedValues[key];
}
}
public UnvalidatedRequestValuesWrapper(UnvalidatedRequestValues unvalidatedValues)
{
this._unvalidatedValues = unvalidatedValues;
}
}
下面是用于支持FormValueProviderFactoryEx的另外几个对象的定义
public sealed class FormValueProviderEx : NameValueCollectionValueProvider
{
public FormValueProviderEx(ControllerContext controllerContext)
: this(controllerContext, new UnvalidatedRequestValuesWrapper(controllerContext.HttpContext.Request.Unvalidated()))
{
}
internal FormValueProviderEx(ControllerContext controllerContext, IUnvalidatedRequestValues unvalidatedValues)
: base(controllerContext.HttpContext.Request.Form, unvalidatedValues.Form, CultureInfo.CurrentCulture)
{
}
public override ValueProviderResult GetValue(string key, bool skipValidation)
{
var result = base.GetValue(key, skipValidation);
if (result == null)
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>