Skip to content

Commit

Permalink
fix PgBinaryExpression support
Browse files Browse the repository at this point in the history
  • Loading branch information
MaceWindu committed Dec 20, 2023
1 parent 982d53b commit 3f39e42
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Source/LinqToDB.EntityFrameworkCore/EFCoreMetadataReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -657,10 +657,11 @@ string PrepareExpressionText(Expression? expr)
return text;
}

// https://github.com/npgsql/efcore.pg/blob/main/src/EFCore.PG/Query/Expressions/Internal/PostgresBinaryExpression.cs
if (newExpression.GetType().Name == "PostgresBinaryExpression")
// https://github.com/npgsql/efcore.pg/blob/main/src/EFCore.PG/Query/Expressions/Internal/PgBinaryExpression.cs
// renamed in 8.0.0
if (newExpression.GetType().Name == "PgBinaryExpression")
{
// Handling Npgsql PostgresBinaryExpression
// Handling Npgsql PgBinaryExpression

var left = (Expression)newExpression.GetType().GetProperty("Left")!.GetValue(newExpression)!;
var right = (Expression)newExpression.GetType().GetProperty("Right")!.GetValue(newExpression)!;
Expand Down Expand Up @@ -699,7 +700,7 @@ string PrepareExpressionText(Expression? expr)
"JsonExistsAny" => "?|",
"JsonExistsAll" => "?&",
_ => throw new InvalidOperationException(
$"Unknown PostgresBinaryExpression.OperatorType: '{operand}'")
$"Unknown PgBinaryExpression.OperatorType: '{operand}'")
};

switch (operand)
Expand Down

0 comments on commit 3f39e42

Please sign in to comment.