Skip to content

Commit

Permalink
Perf: Skip visiting table inside ColumnExpression
Browse files Browse the repository at this point in the history
  • Loading branch information
smitpatel committed Sep 5, 2019
1 parent 7fa7c03 commit 8b2644f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,9 @@ private SqlConstantExpression VisitSqlConstantExpression(SqlConstantExpression s

private ColumnExpression VisitColumnExpression(ColumnExpression columnExpression)
{
var newTable = (TableExpressionBase)Visit(columnExpression.Table);
_isNullable = columnExpression.IsNullable;

return columnExpression.Update(newTable);
return columnExpression;
}

private SqlParameterExpression VisitSqlParameterExpression(SqlParameterExpression sqlParameterExpression)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,7 @@ private ColumnExpression(string name, TableExpressionBase table, Type type, Rela
public TableExpressionBase Table { get; }
public bool IsNullable { get; }

protected override Expression VisitChildren(ExpressionVisitor visitor)
=> Update((TableExpressionBase)visitor.Visit(Table));

public virtual ColumnExpression Update(TableExpressionBase table)
=> table != Table
? new ColumnExpression(Name, table, Type, TypeMapping, IsNullable)
: this;
protected override Expression VisitChildren(ExpressionVisitor visitor) => this;

public ColumnExpression MakeNullable()
=> new ColumnExpression(Name, Table, Type.MakeNullable(), TypeMapping, true);
Expand Down

0 comments on commit 8b2644f

Please sign in to comment.