public static IQueryable FindSource(Expression e) { var visitor = new QuerySourceExpressionVisitor(); visitor.Visit(e); return(visitor.sourceQueryable); }
static Type FindSourceType(Expression e) { var sourceQuery = QuerySourceExpressionVisitor.FindSource(e); if (sourceQuery == null) { throw new NotSupportedException("Unable to identify an IQueryable source for this query."); } return(sourceQuery.ElementType); }