Sha*_*dix 9 c# odata wcf-web-api asp.net-mvc-4
ASP.NET MVC4 Beta引入了一种使用WebAPI创建OData端点的简便方法.
所以有以下控制器:
public class ValuesController : ApiController
{
// GET /api/values
public IQueryable<Document> Get()
{
return (new[] {
new Document() { Info = "a", Title = "qwe1" },
new Document() { Info = "b", Title = "qwe2" }, }).AsQueryable();
}
}
Run Code Online (Sandbox Code Playgroud)
我可以使用url来查询数据:http:// localhost:44087/api/values?$ filter = Title eq'qwe1'
是否有适当的.net库可以使用它?所以我可以这样做:
new WebApiClient("http://localhost:44087/api/values")
.Get<Document>().Where(x=>x.Title == "qwe1").ToList()
Run Code Online (Sandbox Code Playgroud)
没有$filter=Title eq 'qwe1'手动指定部件?