Class QuerySqlGenerator
- Namespace
- Microsoft.EntityFrameworkCore.Query
- Assembly
- Microsoft.EntityFrameworkCore.Relational.dll
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 : SqlExpressionVisitor
- Inheritance
-
QuerySqlGenerator
- Inherited Members
Constructors
QuerySqlGenerator(QuerySqlGeneratorDependencies)
Creates a new instance of the QuerySqlGenerator class.
public QuerySqlGenerator(QuerySqlGeneratorDependencies dependencies)
Parameters
dependenciesQuerySqlGeneratorDependenciesParameter object containing dependencies for this class.
Properties
AliasSeparator
The default alias separator.
protected virtual string AliasSeparator { get; }
Property Value
Dependencies
Parameter object containing service dependencies.
protected virtual QuerySqlGeneratorDependencies Dependencies { get; }
Property Value
Sql
The current SQL command builder.
protected virtual IRelationalCommandBuilder Sql { get; }
Property Value
Methods
CheckComposableSql(string)
Checks whether a given SQL string is composable, i.e. can be embedded as a subquery within a larger SQL query.
protected virtual void CheckComposableSql(string sql)
Parameters
sqlstringAn SQL string to be checked for composability.
Exceptions
- InvalidOperationException
The given SQL isn't composable.
GenerateLimitOffset(SelectExpression)
Generates a LIMIT...OFFSET... construct in the relational command
protected virtual void GenerateLimitOffset(SelectExpression selectExpression)
Parameters
selectExpressionSelectExpressionA select expression to use.
GenerateOperator(SqlBinaryExpression)
Generates a SQL operator for a SQL binary operation.
[Obsolete("Use GetOperator instead.")]
protected virtual string GenerateOperator(SqlBinaryExpression binaryExpression)
Parameters
binaryExpressionSqlBinaryExpressionA SQL binary operation.
Returns
- string
A string representation of the binary operator.
GenerateOrderings(SelectExpression)
Generates an ORDER BY clause in the relational command
protected virtual void GenerateOrderings(SelectExpression selectExpression)
Parameters
selectExpressionSelectExpressionA select expression to use.
GeneratePseudoFromClause()
Generates a pseudo FROM clause. Required by some providers when a query has no actual FROM clause.
protected virtual void GeneratePseudoFromClause()
GenerateSetOperation(SetOperationBase)
Generates a set operation in the relational command.
protected virtual void GenerateSetOperation(SetOperationBase setOperation)
Parameters
setOperationSetOperationBaseA set operation to print.
GenerateSetOperationOperand(SetOperationBase, SelectExpression)
Generates an operand for a given set operation in the relational command.
protected virtual void GenerateSetOperationOperand(SetOperationBase setOperation, SelectExpression operand)
Parameters
setOperationSetOperationBaseA set operation to use.
operandSelectExpressionA set operation operand to print.
GenerateTagsHeaderComment(SelectExpression)
Generates the head comment for tags.
protected virtual void GenerateTagsHeaderComment(SelectExpression selectExpression)
Parameters
selectExpressionSelectExpressionA select expression to generate tags for.
GenerateTop(SelectExpression)
Generates a TOP construct in the relational command
protected virtual void GenerateTop(SelectExpression selectExpression)
Parameters
selectExpressionSelectExpressionA select expression to use.
GetCommand(SelectExpression)
Gets a relational command for a SelectExpression.
public virtual IRelationalCommand GetCommand(SelectExpression selectExpression)
Parameters
selectExpressionSelectExpressionA select expression to print in command text.
Returns
- IRelationalCommand
A relational command with a SQL represented by the select expression.
GetOperator(SqlBinaryExpression)
Gets a SQL operator for a SQL binary operation.
protected virtual string GetOperator(SqlBinaryExpression binaryExpression)
Parameters
binaryExpressionSqlBinaryExpressionA SQL binary operation.
Returns
- string
A string representation of the binary operator.
VisitCase(CaseExpression)
protected override Expression VisitCase(CaseExpression caseExpression)
Parameters
caseExpressionCaseExpression
Returns
VisitCollate(CollateExpression)
protected override Expression VisitCollate(CollateExpression collateExpresion)
Parameters
collateExpresionCollateExpression
Returns
VisitColumn(ColumnExpression)
protected override Expression VisitColumn(ColumnExpression columnExpression)
Parameters
columnExpressionColumnExpression
Returns
VisitCrossApply(CrossApplyExpression)
protected override Expression VisitCrossApply(CrossApplyExpression crossApplyExpression)
Parameters
crossApplyExpressionCrossApplyExpression
Returns
VisitCrossJoin(CrossJoinExpression)
protected override Expression VisitCrossJoin(CrossJoinExpression crossJoinExpression)
Parameters
crossJoinExpressionCrossJoinExpression
Returns
VisitDistinct(DistinctExpression)
protected override Expression VisitDistinct(DistinctExpression distinctExpression)
Parameters
distinctExpressionDistinctExpression
Returns
VisitExcept(ExceptExpression)
protected override Expression VisitExcept(ExceptExpression exceptExpression)
Parameters
exceptExpressionExceptExpression
Returns
VisitExists(ExistsExpression)
protected override Expression VisitExists(ExistsExpression existsExpression)
Parameters
existsExpressionExistsExpression
Returns
VisitFromSql(FromSqlExpression)
protected override Expression VisitFromSql(FromSqlExpression fromSqlExpression)
Parameters
fromSqlExpressionFromSqlExpression
Returns
VisitIn(InExpression)
protected override Expression VisitIn(InExpression inExpression)
Parameters
inExpressionInExpression
Returns
VisitInnerJoin(InnerJoinExpression)
protected override Expression VisitInnerJoin(InnerJoinExpression innerJoinExpression)
Parameters
innerJoinExpressionInnerJoinExpression
Returns
VisitIntersect(IntersectExpression)
protected override Expression VisitIntersect(IntersectExpression intersectExpression)
Parameters
intersectExpressionIntersectExpression
Returns
VisitLeftJoin(LeftJoinExpression)
protected override Expression VisitLeftJoin(LeftJoinExpression leftJoinExpression)
Parameters
leftJoinExpressionLeftJoinExpression
Returns
VisitLike(LikeExpression)
protected override Expression VisitLike(LikeExpression likeExpression)
Parameters
likeExpressionLikeExpression
Returns
VisitOrdering(OrderingExpression)
protected override Expression VisitOrdering(OrderingExpression orderingExpression)
Parameters
orderingExpressionOrderingExpression
Returns
VisitOuterApply(OuterApplyExpression)
protected override Expression VisitOuterApply(OuterApplyExpression outerApplyExpression)
Parameters
outerApplyExpressionOuterApplyExpression
Returns
VisitProjection(ProjectionExpression)
protected override Expression VisitProjection(ProjectionExpression projectionExpression)
Parameters
projectionExpressionProjectionExpression
Returns
VisitRowNumber(RowNumberExpression)
protected override Expression VisitRowNumber(RowNumberExpression rowNumberExpression)
Parameters
rowNumberExpressionRowNumberExpression
Returns
VisitScalarSubquery(ScalarSubqueryExpression)
protected override Expression VisitScalarSubquery(ScalarSubqueryExpression scalarSubqueryExpression)
Parameters
scalarSubqueryExpressionScalarSubqueryExpression
Returns
VisitSelect(SelectExpression)
protected override Expression VisitSelect(SelectExpression selectExpression)
Parameters
selectExpressionSelectExpression
Returns
VisitSqlBinary(SqlBinaryExpression)
protected override Expression VisitSqlBinary(SqlBinaryExpression sqlBinaryExpression)
Parameters
sqlBinaryExpressionSqlBinaryExpression
Returns
VisitSqlConstant(SqlConstantExpression)
protected override Expression VisitSqlConstant(SqlConstantExpression sqlConstantExpression)
Parameters
sqlConstantExpressionSqlConstantExpression
Returns
VisitSqlFragment(SqlFragmentExpression)
protected override Expression VisitSqlFragment(SqlFragmentExpression sqlFragmentExpression)
Parameters
sqlFragmentExpressionSqlFragmentExpression
Returns
VisitSqlFunction(SqlFunctionExpression)
protected override Expression VisitSqlFunction(SqlFunctionExpression sqlFunctionExpression)
Parameters
sqlFunctionExpressionSqlFunctionExpression
Returns
VisitSqlParameter(SqlParameterExpression)
protected override Expression VisitSqlParameter(SqlParameterExpression sqlParameterExpression)
Parameters
sqlParameterExpressionSqlParameterExpression
Returns
VisitSqlUnary(SqlUnaryExpression)
protected override Expression VisitSqlUnary(SqlUnaryExpression sqlUnaryExpression)
Parameters
sqlUnaryExpressionSqlUnaryExpression
Returns
VisitTable(TableExpression)
protected override Expression VisitTable(TableExpression tableExpression)
Parameters
tableExpressionTableExpression
Returns
VisitTableValuedFunction(TableValuedFunctionExpression)
protected override Expression VisitTableValuedFunction(TableValuedFunctionExpression tableValuedFunctionExpression)
Parameters
tableValuedFunctionExpressionTableValuedFunctionExpression
Returns
VisitUnion(UnionExpression)
protected override Expression VisitUnion(UnionExpression unionExpression)
Parameters
unionExpressionUnionExpression