Class ExpressionPlanEqualityComparer
Compares expressions structurally so that logically identical queries share a cached plan. Owns the
thread-static hashing visitor used by GetHashCode.
public class ExpressionPlanEqualityComparer : IEqualityComparer<Expression?>
- Inheritance
-
ExpressionPlanEqualityComparer
- Implements
- Inherited Members
- Extension Methods
Constructors
ExpressionPlanEqualityComparer(IQueryRegistry)
Creates a comparer for the given registry without plan-cache logging.
public ExpressionPlanEqualityComparer(IQueryRegistry queryProvider)
Parameters
queryProviderIQueryRegistryThe registry that resolves referenced queries and nested comparers.
ExpressionPlanEqualityComparer(IQueryRegistry, ILogger?)
Creates a comparer for the given registry, logging plan-cache misses through logger.
public ExpressionPlanEqualityComparer(IQueryRegistry queryProvider, ILogger? logger)
Parameters
queryProviderIQueryRegistryThe registry that resolves referenced queries and nested comparers.
loggerILoggerThe optional logger for plan-cache diagnostics.
Methods
Equals(Expression?, Expression?)
Determines whether the specified objects are equal.
public bool Equals(Expression? left, Expression? right)
Parameters
leftExpressionrightExpression
Returns
GetHashCode(Expression)
Returns a structural hash of obj, resolving nested commands and outer
references through the registry.
public int GetHashCode(Expression obj)
Parameters
objExpressionThe expression to hash.
Returns
- int
The structural hash, or
0whenobjisnull.