C# ASP.NET Web Api 2-get请求中的数组

C# ASP.NET Web Api 2-get请求中的数组,c#,asp.net,json,asp.net-web-api,model-binding,C#,Asp.net,Json,Asp.net Web Api,Model Binding,我正在将使用服务堆栈的项目转换为ASP.NET Web API 2。ServiceStack允许我做的是在GET请求的URI中发送JSON字符串化对象 这是我的课程: public class ShowsByTitles { public string Query { set; get; } public List<IgnoreShowIds> IgnoreIds { set; get; } public List<long> IgnoreTyp

我正在将使用服务堆栈的项目转换为ASP.NET Web API 2。ServiceStack允许我做的是在GET请求的URI中发送JSON字符串化对象

这是我的课程:

public class ShowsByTitles 
{
    public string Query { set; get; }
    public List<IgnoreShowIds> IgnoreIds { set; get; }
    public List<long> IgnoreTypes { set; get; }
    public List<long> OnlyTypes { set; get; } 

    public long Id { get; private set; }
    public string FilterName { set; get; }
    public Dictionary<string, string> FilterData { get; set; }

    public ShowsByTitles()
    {
        IgnoreIds = new List<IgnoreShowIds>();
    }
}

public class IgnoreShowIds
    {
        public long ShowTypeId { set; get; }
        public long ShowId { set; get; }
    }
公共类showsbytles
{
公共字符串查询{set;get;}
公共列表ignoreid{set;get;}
公共列表IgnoreTypes{set;get;}
仅公共列表类型{set;get;}
公共长Id{get;private set;}
公共字符串筛选器名称{set;get;}
公共字典筛选器数据{get;set;}
公演节目
{
IgnoreIds=新列表();
}
}
公共类IgnoreShowIds
{
公共长ShowTypeId{set;get;}
公共长ShowId{set;get;}
}
使用服务堆栈,我可以发出以下请求: {ShowTypeId:1,ShowId:5}]&IgnoreTypes=[]&OnlyTypes=[2,3]

如何使此样式与Web API 2配合使用?我尝试了这种方法: 但它不起作用


非常感谢你的帮助。谢谢

想知道为什么要用查询字符串而不是用POST发送请求体中的数据?Web API不支持ServiceStack具有的JSV格式。我不确定JSV是否是一种众所周知的格式。如果您计划执行服务堆栈提供的功能,则需要在Web API中有自定义实现……因为我需要发送一个数组作为获取某些内容的选项。我正在构建一个RESTful风格的API,而POST毫无意义。基本上,我需要发送一个整数数组,比如/api/shows?genres=[100300101305]。我最终得到了一个自定义实现。我很好奇你最终得到了什么自定义实现。如果可以,请将其作为答案张贴。