phil soady
phil soady

Reputation: 11348

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

PM> Install-Package DynamicLINQ

I'm trying to construct a where clause that involves Guids

I have tried with the string "Id == @0". The parameter array is just an object[] with the value (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

Operator '==' incompatible with operand types 'Guid' and 'Guid'

Any ideas?

Upvotes: 6

Views: 5701

Answers (1)

p.s.w.g
p.s.w.g

Reputation: 149030

Try using the Equals method instead of the == operator in your string:

"Id.Equals(@0)"

Upvotes: 7

Related Questions