示例#1
0
        public static Query JoinLastTableSource(this Query query, TableSourceBase joinTableSource, PredicateBase on, JoinType joinType)
        {
            Argument.NotNull(query, "query");
            Argument.NotNull(joinTableSource, "joinTableSource");
            var lastTableSource = query.From.InternalNodes.LastOrDefault();

            if (lastTableSource == null)
            {
                throw new InvalidOperationException("Query's table source list is empty.");
            }
            var newTableSource = new JoinedTableSource(lastTableSource, joinTableSource, on, joinType);

            return(new Query(query.Select, query.From.ReplaceLast(newTableSource), query.Where));
        }
示例#2
0
 protected internal virtual void VisitJoinedTableSource(JoinedTableSource tableSource)
 {
     Visit(tableSource.Left);
     Visit(tableSource.Right);
     Visit(tableSource.On);
 }