Breeze版本:1.4.14
我有两个实体:人和病人。人员有一个电话和患者继承人的名单。
我可以在服务器上查询:
var patients = Patients.Where(x => x.Telephones.Where(xx => xx.Number == "XXXX-XXXX").Any());
我还可以在浏览器上显示粘贴此网址的结果:
/breeze/Patients?$filter=Telephones/any(x1: x1/Number eq 'XXXX-XXXX')
但是如果我尝试从客户端执行一个微风查询
var query = breeze.EntityQuery.from("Patients");
query = query.where("telephones", "any", "number", "==", "XXXX-XXXX");
我收到错误:
"TypeError: Cannot read property 'isAnonymous' of undefined breeze.debug.js:14807:34"
如果我将查询更改为基表" Person"它有效:
var query = breeze.EntityQuery.from("Person");
query = query.where("telephones", "any", "number", "==", "XXXX-XXXX");
但我真的需要所有患者数据......我做错了什么还是这个错误?
答案 0 :(得分:1)
我现在不知道这是一个错误,但是我通过在查询中调用toType()
来解决它:
var query = breeze.EntityQuery.from("Patients").toType("Patient");
query = query.where("telephones", "any", "number", "==", "XXXX-XXXX");
答案 1 :(得分:-1)
您好使用此代码来解决您的问题......
var query = breeze.EntityQuery.from("Patients);
query = query.where("telephones", "breeze.FilterQueryOp.any", "number", "breeze.FilterQueryOp.eq", "XXXX-XXXX");