当我尝试在OData服务上使用Breezejs的ANY运算符时出错:
var query = breeze.EntityQuery.from("Orders")
.where("orderLines", breeze.FilterQueryOp.Any, "quantity", breeze.FilterQueryOp.GreaterThan, 50);
我收到以下错误:
"TypeError: Cannot read property 'isAnonymous' of undefined
at proto._validate (http://localhost/app/bower_components/bower-breeze/breeze.debug.js:10334:27)
at Function.ctor.create (http://localhost/app/bower_components/bower-breeze/breeze.debug.js:10288:18)
at proto.validate (http://localhost/app/bower_components/bower-breeze/breeze.debug.js:10908:36)
at proto.validate (http://localhost/app/bower_components/bower-breeze/breeze.debug.js:10913:25)
at proto.toODataFragment (http://localhost/app/bower_components/bower-breeze/breeze.debug.js:10837:14)
at toFilterString (http://localhost/app/bower_components/bower-breeze/breeze.debug.js:10011:27)
at proto._toUri (http://localhost/app/bower_components/bower-breeze/breeze.debug.js:9991:35)
at proto.toQueryString (http://localhost/app/bower_components/bower-breeze/breeze.debug.js:6380:26)
at proto.getUrl (http://localhost/app/bower_components/bower-breeze/breeze.debug.js:14140:61)
at fn.executeQuery (http://localhost/app/bower_components/bower-breeze/breeze.debug.js:15073:34)".
此HTTP请求运行良好:
http://localhost/api/service.svc/Orders?$filter=orderLines/any(ol:ol/quantity gt 50)
当我在执行查询之前尝试使用元数据时,我遇到以下错误:
var query = breeze.EntityQuery.from("Orders").top(10);
manager.fetchMetadata().then(function () {
return manager.executeQuery(query).fail(function (data) {
$log.error(data)
});
}).then(function (data) {
$log.info(data);
});
Error: Unable to locate a 'Type' by the name: 'Order:#System.Data.Objects'. Be sure to execute a query or call fetchMetadata first.
Breeze似乎使用了错误的命名空间' Order:#System.Data.Objects'。正确的命名空间是' App.API.Context'像exportMetadata函数显示:
{
"shortName": "Order",
"namespace": "App.API.Context",
"autoGeneratedKeyType": "Identity",
...
}
感谢您的帮助!