简体   繁体   English

运算符&#39;==&#39;与使用DynamicExpression.ParseLambda的操作数类型&#39;Guid&#39;和&#39;Guid&#39;不兼容<T, bool>

[英]Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool>

I'm Using Dynamic Linq library and there is Source code and basic docu and the Nuget version 我正在使用Dynamic Linq库 ,有源代码和基本文档以及Nuget版本

PM> Install-Package DynamicLINQ PM> Install-Package DynamicLINQ

I'm trying to construct a where clause that involves Guids 我正在尝试构建一个涉及Guids的where子句

I have tried with the string "Id == @0" . 我尝试过使用字符串"Id == @0" The parameter array is just an object[] with the value ( Guid xxxx ) 参数数组只是一个带有值的object[]Guid xxxx

  var whereClauseSB = BuildLogicalKeyWhereClause2(entity, logicalKey);  //build string
  var parms = BuildParamArray(entity, logicalKey); // object[]
  var whereLambda = Ofsi.Bos.Core.DynamicExpression.ParseLambda<T, bool>(whereClauseSB.ToString(),parms);  //parse

an exception is thrown in DynamicExpression.ParseLambda DynamicExpression.ParseLambda中抛出异常

Operator '==' incompatible with operand types 'Guid' and 'Guid' 运算符'=='与操作数类型'Guid'和'Guid'不兼容

  • I have also tried with GUID and String.(fail) 我也试过GUID和String。(失败)
  • I tried with and "Id = @0" (fail). 我试过和“Id = @ 0”(失败)。
  • String == string works, as does Int32==int32 but not Guid == Guid does not String == string工作,Int32 == int32但不是Guid == Guid没有

Any ideas? 有任何想法吗?

尝试在字符串中使用Equals方法而不是==运算符:

"Id.Equals(@0)"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用 DynamicExpression.ParseLambda 的谓词 - Predicate with DynamicExpression.ParseLambda TryParse for DynamicExpression.ParseLambda - TryParse for DynamicExpression.ParseLambda DynamicExpression.ParseLambda可以在对象上设置值? - DynamicExpression.ParseLambda to set a value on an object? 检测到类型不兼容的二元运算符。 找到运算符类型“Equal”的操作数类型“Edm.Guid”和“Edm.String” - A binary operator with incompatible types was detected. Found operand types 'Edm.Guid' and 'Edm.String' for operator kind 'Equal' 检测到具有不兼容类型的二元运算符。找到操作数类型edm.string和edm.guid用于种类相等 - A binary operator with incompatible types was detected. Found operand types edm.string and edm.guid for kind equal ?? 和布尔进行三元运算? 和吉德? 类型 - ?? and ternary operations with Bool? and Guid? types 如何将多行的lambda语句字符串解析为DynamicExpression.ParseLambda? - How to parse a multi-lined lambda statement string into DynamicExpression.ParseLambda? 为GUID定义增量运算符 - Defining Increment Operator for GUID Linq动态查询问题-运算符“ OR”与操作数类型“ Boolean”和“ String”不兼容 - Linq Dynamic Query Issue - Operator 'OR' incompatible with operand types 'Boolean' and 'String' 可以为空的 Guid 的 Dapper 问题? 类型 - Dapper problem with a nullable Guid? types
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM