【发布时间】:2012-02-02 23:40:56
【问题描述】:
我正在使用 WCF Web api 构建一个从 odata 查询返回复杂对象的休息服务。不幸的是,查询复杂类型似乎不起作用。例如
public IQueryable<Person> Get()
{
var people = new List<Person>()
{
new Person {
Name="John",
Department = new Department{Id=2, Description="Lion Swaddling"}
},
new Person {
Name="Jane",
Department = new Department{Id=4, Description="Face Surgery"}
},
};
return people.AsQueryable();
}
以下 uri 不返回任何内容。 http://localhost/api/people?$filter=部门/Id%20eq%20'2'
Web Api 实际上是否支持查询复杂类型?如果是这样,我必须要启用它吗?
【问题讨论】:
标签: wcf wcf-data-services odata wcf-web-api