public static SqlReferencedRelatedObjectPropertyGathererResults Gather(DataAccessModel model, IList <Tuple <ParameterExpression, Expression> > expressions, bool forProjection)
        {
            var gatherer = new SqlReferencedRelatedObjectPropertyGatherer(model, null, forProjection);

            var reducedExpressions = expressions.Select(c =>
            {
                gatherer.sourceParameterExpression = c.Item1;
                return(SqlExpressionReplacer.Replace(gatherer.Visit(c.Item2), d => d.StripItemsCalls()));
            }).ToArray();

            return(new SqlReferencedRelatedObjectPropertyGathererResults
            {
                ReducedExpressions = reducedExpressions,
                ReferencedRelatedObjects = gatherer.results.Values.ToList(),
                RootExpressionsByPath = gatherer.rootExpressionsByPath,
                IncludedPropertyInfoByExpression = gatherer
                                                   .includedPropertyInfos
                                                   .GroupBy(c => c.RootExpression)
                                                   .ToDictionary(c => c.Key, c => c.ToList())
            });
        }
 public DisableCompareContext(SqlReferencedRelatedObjectPropertyGatherer gatherer)
 {
     this.gatherer            = gatherer;
     this.savedDisableCompare = gatherer.disableCompare;
     gatherer.disableCompare  = true;
 }