Class QueryPlan
Canonical, hashable description of a query, used as the key of the plan cache.
public sealed class QueryPlan : IEquatable<QueryPlan>
- Inheritance
-
QueryPlan
- Implements
- Inherited Members
- Extension Methods
Constructors
QueryPlan(QueryCommand, string?)
Captures a canonical, hashable description of cmd and computes its stable
hash. Used as the key of the plan cache.
public QueryPlan(QueryCommand cmd, string? sql)
Parameters
cmdQueryCommandThe command to describe.
sqlstringThe generated SQL, which participates in the hash when known.
Fields
QueryCommand
The query command this plan describes. Replaced by an equal clone when GetCacheVersion() is called.
public QueryCommand QueryCommand
Field Value
Methods
Equals(QueryPlan?)
Determines whether another plan has the same SQL and an equivalent query command.
public bool Equals(QueryPlan? obj)
Parameters
Returns
Equals(object?)
Determines whether obj is a plan equal to this one.
public override bool Equals(object? obj)
Parameters
Returns
GetCacheVersion()
Replaces QueryCommand with an equal clone whose build-time state has been released, so the plan can be stored in the cache without retaining the original query tree. The plan's hash is unchanged, preserving its identity as a dictionary key.
public QueryPlan GetCacheVersion()
Returns
- QueryPlan
This plan, after the command has been swapped for its cache clone.
GetHashCode()
Returns the hash captured when the plan was constructed, keeping plan identity stable even after GetCacheVersion() swaps in an equal command clone.
public override int GetHashCode()
Returns
- int
The stable plan hash.