Share via


QuerySqlGenerator.TryGetOperatorInfo(SqlExpression, Int32, Boolean) Method

Definition

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.

protected virtual bool TryGetOperatorInfo (Microsoft.EntityFrameworkCore.Query.SqlExpressions.SqlExpression expression, out int precedence, out bool isAssociative);
abstract member TryGetOperatorInfo : Microsoft.EntityFrameworkCore.Query.SqlExpressions.SqlExpression * int * bool -> bool
override this.TryGetOperatorInfo : Microsoft.EntityFrameworkCore.Query.SqlExpressions.SqlExpression * int * bool -> bool
Protected Overridable Function TryGetOperatorInfo (expression As SqlExpression, ByRef precedence As Integer, ByRef isAssociative As Boolean) As Boolean

Parameters

expression
SqlExpression

The expression for which to get the precedence and associativity.

precedence
Int32

If the method returned true, contains the precedence of the provided expression. Otherwise, contains default values.

isAssociative
Boolean

If the method returned true, contains the associativity of the provided expression. Otherwise, contains default values.

Returns

true if the expression operator info is known and was returned in precedence and isAssociative. Otherwise, false.

Remarks

The default implementation always returns false, so that parentheses almost always get added. Providers can override this method to remove parentheses where they aren't necessary.

Applies to