Extract column expression from UnaryExpression as well

pull/144/head
Christopher Jolly 2 years ago
parent ab3449349f
commit 4fc2cb55b7

@ -165,7 +165,20 @@ namespace EntityFrameworkCore.Jet.Query.Sql.Internal
if (tableExpression is InnerJoinExpression expression) if (tableExpression is InnerJoinExpression expression)
{ {
SqlBinaryExpression? binaryJoin = expression.JoinPredicate as SqlBinaryExpression; SqlBinaryExpression? binaryJoin = expression.JoinPredicate as SqlBinaryExpression;
tempcolexp = ExtractColumnExpressions(binaryJoin!); SqlUnaryExpression? unaryJoin = expression.JoinPredicate as SqlUnaryExpression;
if (binaryJoin != null)
{
tempcolexp = ExtractColumnExpressions(binaryJoin!);
}
else if (unaryJoin != null)
{
tempcolexp = ExtractColumnExpressions(unaryJoin!);
}
else
{
tempcolexp = new List<ColumnExpression>();
}
bool refrencesfirsttable = false; bool refrencesfirsttable = false;
foreach (ColumnExpression col in tempcolexp) foreach (ColumnExpression col in tempcolexp)
{ {
@ -316,6 +329,20 @@ namespace EntityFrameworkCore.Jet.Query.Sql.Internal
return result; return result;
} }
private List<ColumnExpression> ExtractColumnExpressions(SqlUnaryExpression unaryexp)
{
List<ColumnExpression> result = new List<ColumnExpression>();
if (unaryexp.Operand is SqlBinaryExpression left)
{
result.AddRange(ExtractColumnExpressions(left));
}
else if (unaryexp.Operand is ColumnExpression colLeft)
{
result.Add(colLeft);
}
return result;
}
protected override Expression VisitProjection(ProjectionExpression projectionExpression) protected override Expression VisitProjection(ProjectionExpression projectionExpression)
{ {

Loading…
Cancel
Save