Signum.Engine.Linq.SubqueryRemover.Remove C# (CSharp) Method

Remove() public static method

public static Remove ( Expression expression, IEnumerable selectsToRemove ) : Expression
expression System.Linq.Expressions.Expression
selectsToRemove IEnumerable
return System.Linq.Expressions.Expression
        public static Expression Remove(Expression expression, IEnumerable<SelectExpression> selectsToRemove)
        {
            return new SubqueryRemover
            {
                map = selectsToRemove.ToDictionary(d => d.Alias, d => d.Columns.ToDictionary(d2 => d2.Name, d2 => d2.Expression)),
                selectsToRemove = new HashSet<SelectExpression>(selectsToRemove)
            }.Visit(expression);
        }

Usage Example

 protected internal override Expression VisitProjection(ProjectionExpression proj)
 {
     proj = (ProjectionExpression)base.VisitProjection(proj);
     if (proj.Select.From is SelectExpression)
     {
         List <SelectExpression> redundant = RedundantSubqueryGatherer.Gather(proj.Select);
         if (redundant != null)
         {
             proj = (ProjectionExpression)SubqueryRemover.Remove(proj, redundant);
         }
     }
     return(proj);
 }
All Usage Examples Of Signum.Engine.Linq.SubqueryRemover::Remove