chore(sonar): demote single-use field to local (S1450)
LinqExpressionVisitor._tableName was only assigned and read inside VisitConstant immediately before assigning FromClause. Drop the field entirely and assign FromClause directly from entityType.Name. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
c06ab2ea29
commit
b6ebb8c7cd
@@ -13,7 +13,6 @@ public class LinqExpressionVisitor : ExpressionVisitor
|
|||||||
private readonly StringBuilder _orderByBuilder = new();
|
private readonly StringBuilder _orderByBuilder = new();
|
||||||
private readonly List<string> _methodCalls = new();
|
private readonly List<string> _methodCalls = new();
|
||||||
private bool _isInWhereClause;
|
private bool _isInWhereClause;
|
||||||
private string? _tableName;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the SELECT clause extracted from the expression.
|
/// Gets the SELECT clause extracted from the expression.
|
||||||
@@ -119,8 +118,7 @@ public class LinqExpressionVisitor : ExpressionVisitor
|
|||||||
var entityType = node.Type.GetGenericArguments().FirstOrDefault();
|
var entityType = node.Type.GetGenericArguments().FirstOrDefault();
|
||||||
if (entityType != null)
|
if (entityType != null)
|
||||||
{
|
{
|
||||||
_tableName = entityType.Name;
|
FromClause = entityType.Name;
|
||||||
FromClause = _tableName;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user