Partilhar via


QuerySqlGenerator Class

Definition

A query SQL generator to get IRelationalCommand for given SelectExpression.

This type is typically used by database providers (and other extensions). It is generally not used in application code.

public class QuerySqlGenerator : Microsoft.EntityFrameworkCore.Query.SqlExpressionVisitor
type QuerySqlGenerator = class
    inherit SqlExpressionVisitor
Public Class QuerySqlGenerator
Inherits SqlExpressionVisitor
Inheritance

Constructors

QuerySqlGenerator(QuerySqlGeneratorDependencies)

Creates a new instance of the QuerySqlGenerator class.

Properties

AliasSeparator

The default alias separator.

Dependencies

Relational provider-specific dependencies for this service.

Sql

The current SQL command builder.

Methods

CheckComposableSql(String)

Checks whether a given SQL string is composable, i.e. can be embedded as a subquery within a larger SQL query.

CheckComposableSqlTrimmed(ReadOnlySpan<Char>)

Checks whether a given SQL string is composable, i.e. can be embedded as a subquery within a larger SQL query. The provided sql is already trimmed for whitespace and comments.

GenerateEmptyProjection(SelectExpression)

Generates SQL for an empty projection for a SELECT expression. This is typically a single 1 literal, but can be overridden for providers which require a different format.

GenerateExists(ExistsExpression, Boolean)

Generates SQL for an EXISTS expression.

GenerateFrom(SelectExpression)

Generates SQL for the FROM clause of the given SELECT expression.

GenerateIn(InExpression, Boolean)

Generates SQL for an IN expression.

GenerateLike(LikeExpression, Boolean)

Generates SQL for the LIKE expression.

GenerateLimitOffset(SelectExpression)

Generates SQL for the LIMIT/OFFSET clauses of the given SELECT expression.

GenerateOperator(SqlBinaryExpression)
Obsolete.

Generates a SQL operator for a SQL binary operation.

GenerateOrderings(SelectExpression)

Generates SQL for the ORDER BY clause of the given SELECT expression.

GenerateProjection(SelectExpression)

Generates SQL for the projection clause of the given SELECT expression.

GeneratePseudoFromClause()

Generates SQL for a pseudo FROM clause. This is required by some providers when a query has no actual FROM clause.

GenerateRootCommand(Expression)

Generates the command for the given top-level query expression. This allows providers to intercept if an expression requires different processing when it is at top-level.

GenerateSetOperation(SetOperationBase)

Generates SQL for a set operation.

GenerateSetOperationOperand(SetOperationBase, SelectExpression)

Generates SQL for an operand within a set operation.

GenerateTagsHeaderComment(ISet<String>)

Generates the head comment for tags.

GenerateTagsHeaderComment(SelectExpression)
Obsolete.

Generates the head comment for tags.

GenerateTop(SelectExpression)

Generates SQL for the TOP clause of the given SELECT expression.

GenerateValues(ValuesExpression)

Generates SQL for a VALUES expression.

GetCommand(Expression)

Gets a relational command for a query expression.

GetCommand(SelectExpression)

Gets a relational command for a SelectExpression.

GetOperator(SqlBinaryExpression)

Gets the SQL operator for a SQL binary operation.

RequiresParentheses(SqlExpression, SqlExpression)

Returns a bool value indicating if the inner SQL expression required to be put inside parenthesis when generating SQL for outer SQL expression.

TryGenerateWithoutWrappingSelect(SelectExpression)

If possible, generates the expression contained within the provided selectExpression without the wrapping SELECT. This can be done for set operations and VALUES, which can appear as top-level statements without needing to be wrapped in SELECT.

TryGetOperatorInfo(SqlExpression, Int32, Boolean)

Returns a numeric value representing the precedence of the given expression, as well as its associativity. These control whether parentheses are generated around the expression.

VisitAtTimeZone(AtTimeZoneExpression)

Generates SQL for an AT TIME ZONE expression.

VisitAtTimeZone(AtTimeZoneExpression)

Visits the children of the sql "at time zone" expression.

(Inherited from SqlExpressionVisitor)
VisitCase(CaseExpression)

Generates SQL for a CASE clause CASE/WHEN construct.

VisitCollate(CollateExpression)

Generates SQL for a COLLATE expression.

VisitCollate(CollateExpression)

Visits the children of the collate expression.

(Inherited from SqlExpressionVisitor)
VisitColumn(ColumnExpression)

Generates SQL for a column.

VisitCrossApply(CrossApplyExpression)

Generates SQL for a cross apply.

VisitCrossJoin(CrossJoinExpression)

Generates SQL for a cross join.

VisitDelete(DeleteExpression)

Generates SQL for a DELETE expression

VisitDelete(DeleteExpression)

Visits the children of the delete expression.

(Inherited from SqlExpressionVisitor)
VisitDistinct(DistinctExpression)

Generates SQL for a DISTINCT () clause in an aggregate function invocation.

VisitDistinct(DistinctExpression)

Visits the children of the distinct expression.

(Inherited from SqlExpressionVisitor)
VisitExcept(ExceptExpression)

Generates SQL for an EXCEPT set operation.

VisitExists(ExistsExpression)

Generates SQL for an EXISTS expression.

VisitExtension(Expression) (Inherited from SqlExpressionVisitor)
VisitFromSql(FromSqlExpression)

Generates SQL for a user-provided SQL query.

VisitIn(InExpression)

Generates SQL for an IN expression.

VisitInnerJoin(InnerJoinExpression)

Generates SQL for an inner join.

VisitIntersect(IntersectExpression)

Generates SQL for an INTERSECT set operation.

VisitJsonScalar(JsonScalarExpression)

Generates SQL for a JSON scalar lookup expression.

VisitJsonScalar(JsonScalarExpression)

Visits the children of the JSON scalar expression.

(Inherited from SqlExpressionVisitor)
VisitLeftJoin(LeftJoinExpression)

Generates SQL for a left join.

VisitLike(LikeExpression)

Generates SQL for a LIKE expression.

VisitOrdering(OrderingExpression)

Generates SQL for a single ordering in a SELECT ORDER BY clause.

VisitOuterApply(OuterApplyExpression)

Generates SQL for an outer apply.

VisitProjection(ProjectionExpression)

Generates SQL for a single projection in a SELECT expression.

VisitRowNumber(RowNumberExpression)

Generates SQL for a row number expression.

VisitRowValue(RowValueExpression)

Generates SQL for a row value expression.

VisitRowValue(RowValueExpression)

Visits the children of the row value expression.

(Inherited from SqlExpressionVisitor)
VisitScalarSubquery(ScalarSubqueryExpression)

Generates SQL for a scalar subquery.

VisitScalarSubquery(ScalarSubqueryExpression)

Visits the children of the scalar subquery expression.

(Inherited from SqlExpressionVisitor)
VisitSelect(SelectExpression)

Generates SQL for a SELECT expression.

VisitSqlBinary(SqlBinaryExpression)

Generates SQL for a binary expression.

VisitSqlConstant(SqlConstantExpression)

Generates SQL for a constant.

VisitSqlFragment(SqlFragmentExpression)

Generates SQL for an arbitrary fragment.

VisitSqlFunction(SqlFunctionExpression)

Generates SQL for a function invocation.

VisitSqlParameter(SqlParameterExpression)

Generates SQL for a parameter.

VisitSqlUnary(SqlUnaryExpression)

Generates SQL for a unary expression.

VisitSubSelect(ScalarSubqueryExpression)
VisitSubSelect(ScalarSubqueryExpression) (Inherited from SqlExpressionVisitor)
VisitTable(TableExpression)

Generates SQL for a column.

VisitTableValuedFunction(TableValuedFunctionExpression)

Generates SQL for a table-valued function invocation.

VisitTableValuedFunction(TableValuedFunctionExpression)

Visits the children of the table valued function expression.

(Inherited from SqlExpressionVisitor)
VisitUnion(UnionExpression)

Generates SQL for a UNION set operation.

VisitUpdate(UpdateExpression)

Generates SQL for an UPDATE expression.

VisitUpdate(UpdateExpression)

Visits the children of the update expression.

(Inherited from SqlExpressionVisitor)
VisitValues(ValuesExpression)

Generates SQL for a VALUES expression.

VisitValues(ValuesExpression)

Visits the children of the values expression.

(Inherited from SqlExpressionVisitor)

Applies to