我需要使用默认的 ASP.NET MVC 模型绑定器构建要从以下表单数据中解析的服务器模型:
page:1
pageSize:10
filter[filters][0][field]:ApplicantName
filter[filters][0][operator]:eq
filter[filters][0][value]:e
filter[filters][1][field]:ApplicantName
filter[filters][1][operator]:eq
filter[filters][1][value]:d
filter[filters][2][field]:FamilySize
filter[filters][2][operator]:eq
filter[filters][2][value]:2
filter[filters][3][logic]:or
filter[filters][3][filters][0][field]:WaitList
filter[filters][3][filters][0][operator]:eq
filter[filters][3][filters][0][value]:3
filter[filters][3][filters][1][field]:WaitList
filter[filters][3][filters][1][operator]:doesnotcontain
filter[filters][3][filters][1][value]:3
可以page
,pageSize
但不能对过滤器做同样的事情。尝试了以下方法:
public class DataSourceRequest
{
public int Page { get; set; }
public int PageSize { get; set; }
public DataSourceFilter Filter { get; set; }
}
public class DataSourceFilter
{
public IEnumerable<DataSourceFilter> Filters { get; set; }
public string Logic { get; set; }
public string Field { get; set; }
public string Operator { get; set; }
public string Value { get; set; }
}
但没有成功。RootFilter
不为空,但没有任何嵌套数据。