internal override SqlNode VisitIncludeScope(SqlIncludeScope scope) {
			this.alreadyIncluded = new HashSet<MetaType>();
			try {
				return this.Visit(scope.Child); // Strip the include scope so SqlBinder will be idempotent.
			}
			finally {
				this.alreadyIncluded = null;
			}
		}
Exemple #2
0
 internal virtual SqlNode VisitIncludeScope(SqlIncludeScope node) {
     node.Child = this.Visit(node.Child);
     return node;
 }
		/// <summary>
		/// Convert inner expression from C# expression to basic SQL Query.
		/// </summary>
		/// <param name="node">The expression to convert.</param>
		/// <returns>The converted SQL query.</returns>
		internal SqlNode ConvertOuter(Expression node)
		{
			_dominatingExpression = node;
			_outerNode = true;
			SqlNode retNode;
			retNode = typeof(ITable).IsAssignableFrom(node.Type) ? this.VisitSequence(node) : this.VisitInner(node);

			if(retNode.NodeType == SqlNodeType.MethodCall)
			{
				// if a tree consists of a single method call expression only, that method
				// must be either a mapped stored procedure or a mapped function
				throw Error.InvalidMethodExecution(((SqlMethodCall)retNode).Method.Name);
			}

			// if after conversion the node is an expression, we must
			// wrap it in a select
			SqlExpression sqlExpression = retNode as SqlExpression;
			if(sqlExpression != null)
			{
				retNode = new SqlSelect(sqlExpression, null, _dominatingExpression);
			}
			retNode = new SqlIncludeScope(retNode, _dominatingExpression);
			return retNode;
		}
		internal override SqlNode VisitIncludeScope(SqlIncludeScope scope)
		{
			return new SqlIncludeScope(this.Visit(scope.Child), scope.SourceExpression);
		}