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.

VisitCase(CaseExpression)

Generates SQL for a CASE clause CASE/WHEN construct.

VisitCollate(CollateExpression)

Generates SQL for a COLLATE expression.

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

VisitDistinct(DistinctExpression)

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

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.

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.

VisitScalarSubquery(ScalarSubqueryExpression)

Generates SQL for a scalar subquery.

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)
VisitTable(TableExpression)

Generates SQL for a column.

VisitTableValuedFunction(TableValuedFunctionExpression)

Generates SQL for a table-valued function invocation.

VisitUnion(UnionExpression)

Generates SQL for a UNION set operation.

VisitUpdate(UpdateExpression)

Generates SQL for an UPDATE expression.

VisitValues(ValuesExpression)

Generates SQL for a VALUES expression.

Applies to