18 using System.Collections.Generic;
28 visitor.Visit(expression);
32 return DiscoverQueryReferences(expression, ref level,
new List<QueryReference>());
37 visitor.Visit(expression);
38 level = visitor.Level;
39 return visitor.References;
44 return discovery.Discover(expression);
51 #region ColumnNameDiscovery
57 columnNames =
new List<ObjectName>();
62 return columnNames.ToArray();
66 var value = constant.
Value;
69 foreach (var element in array) {
70 columnNames.AddRange(element.DiscoverReferences());
74 return base.VisitConstant(constant);
79 foreach (var arg
in args) {
80 columnNames.AddRange(arg.DiscoverReferences());
83 return base.VisitFunctionCall(expression);
88 return base.VisitReference(reference);
94 #region SubQueryDiscovery
108 return base.VisitConstant(constant);
ObjectName ReferenceName
Gets the name of the object referenced by the expression.
SqlType Type
Gets the SqlType that defines the object properties
An expression that references an object within a context.
A query to the database to select data from a set of tables and columns.
static void DiscoverTableNames(this SqlExpression expression, IList< ObjectName > tableNames)
static IEnumerable< ObjectName > DiscoverReferences(this SqlExpression expression)
bool Verify(SqlExpression expression)
static IList< QueryReference > DiscoverQueryReferences(this SqlExpression expression, ref int level, IList< QueryReference > list)
override SqlExpression VisitConstant(SqlConstantExpression constant)
ISqlObject Value
Gets the underlined value that is handled.
override SqlExpression VisitFunctionCall(SqlFunctionCallExpression expression)
Visits the expression that calls the function defined.
DataObject Value
Gets the constant value of the expression.
static IList< QueryReference > DiscoverQueryReferences(this SqlExpression expression, ref int level)
IEnumerable< ObjectName > Discover(SqlExpression expression)
override SqlExpression VisitConstant(SqlConstantExpression constant)
static SqlBinaryExpression Add(SqlExpression left, SqlExpression right)
SqlExpression[] Arguments
static bool HasSubQuery(this SqlExpression expression)
An expression that holds a constant value.
readonly List< ObjectName > columnNames
Defines the base class for instances that represent SQL expression tree nodes.
An object that provides methods for accessing a finite collection of SQL expressions.
override SqlExpression VisitReference(SqlReferenceExpression reference)
A visitor for SqlExpression objects.