[英]A binary operator with incompatible types was detected. Found operand types edm.string and edm.guid for kind equal
I implementing a filter using breeze predicate. 我使用breeze谓词实现过滤器。 Using BreezeJs and ASP.NET WebAPI(Breeze Server Side) with Entity Framework
使用BreezeJs和ASP.NET WebAPI(Breeze Server Side)和Entity Framework
The predicate looks like this: 谓词看起来像这样:
var predicate = breezeProvider.breeze.Predicate.create('serialNumber', '==', $scope.filter.serialNumber); predicates.push(predicate);
When I execute the query. 当我执行查询。 Breeze throw an exception with the following messages:
Breeze使用以下消息抛出异常:
A binary operator with incompatible types was detected.
检测到具有不兼容类型的二元运算符。 Found operand types edm.string and edm.guid for kind equal
找到操作数类型edm.string和edm.guid用于种类相等
The $scope.filter.serialNumber is a string and serialNumber is a GUID property $ scope.filter.serialNumber是一个字符串,serialNumber是一个GUID属性
The url is as follow. 网址如下。
http://localhost:51969/breeze/WarehouseProductTransactions/GetProducts ?$filter=(StatusId ne 3d) and (WarehouseId eq 1d) and (AuthorizedADUserId eq 'bTdbnW8t6Uu4D4KHCoQOhg==') and (SerialNumber eq guid'1b9d065e-eb48-4f3d-883c-2c841771a3e8')&$orderby=Id&$top=5&$expand=Inventory,AuthorizedADUser&$inlinecount=allpages&)
http:// localhost:51969 / breeze / WarehouseProductTransactions / GetProducts ?$ filter =(StatusId ne 3d)and(WarehouseId eq 1d)and(AuthorizedADUserId eq'bTdbnW8t6Uu4D4KHCoQOhg ==')和(SerialNumber eq guid'1b9d065e-eb48-4f3d- 883C-2c841771a3e8' )&$的OrderBy =编号&$顶部= 5&$扩大=库存,AuthorizedADUser&$ inlinecount =所有页&)
Note the snippet: 请注意代码段:
(SerialNumber eq guid'1b9d065e-eb48-4f3d-883c-2c841771a3e8')
(SerialNumber eq guid'1b9d065e-eb48-4f3d-883c-2c841771a3e8')
My server side is as follow: 我的服务器端如下:
[EnableBreezeQuery(MaxNodeCount = 200)]
public IQueryable<WarehouseProductTransactionDetail> GetProducts()
{
return _contextProvider.Context.WarehouseProductTransactionDetails;
}
I'm trying to figure out how I can resolve this situation but no idea. 我试图找出如何解决这种情况,但不知道。
Any help is appreciated 任何帮助表示赞赏
I had the same issue when comparing userId in Breeze query. 在Breeze查询中比较userId时遇到了同样的问题。 Breeze appends 'guid' in the OData query.
Breeze在OData查询中附加'guid'。
I was able to fix this issue by appending .toType("entityTypeName")
to the breeze query. 我能够通过将
.toType("entityTypeName")
附加到breeze查询来解决此问题。
let query = new breeze.EntityQuery().from('orders');
let predicate = breeze.Predicate.create("CreatedBy", "==", userId);
query = query.where(predicate).toType("Order");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.