Breeze Web API控制器方法名称约定

时间:2013-02-14 04:05:47

标签: breeze

Official Docs关于breeze和Web API控制器中,我们看到了Web Api控制器上方法名称的某种命名约定。例如,对于Todo实体类型,有一个Todos()方法。

假设我有一个entityType“Customer”。然后我在apiController上创建一个方法:

[HttpGet]
public IQueryable<Customer> GetCustomers() { ... }

在我的客户端javascript应用程序中,我运行EntityQueries:

//api method: GetCustomers
//type name: Customer    

var query = EntityQuery.from("GetCustomers"); 
manager.execute(query); //works

manager.fetchEntityByKey("Customer", 53) //doesn't works!

失败了,我收到了以下错误:

No HTTP resource was found that matches the request URI  
'http://localhost:4119/api/SomeController/Customers?$filter=Id eq 53'

那么,我是否被迫将我的GetCustomers方法重命名为Customers()或者我错过了什么?

0 个答案:

没有答案
相关问题