Table of Contents

Class QueryPlan

Namespace
NextORM.Core
Assembly
nextorm.core.dll

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

cmd QueryCommand

The command to describe.

sql string

The 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

QueryCommand

Methods

Equals(QueryPlan?)

Determines whether another plan has the same SQL and an equivalent query command.

public bool Equals(QueryPlan? obj)

Parameters

obj QueryPlan

The plan to compare with, or null.

Returns

bool

true when the plans are equal.

Equals(object?)

Determines whether obj is a plan equal to this one.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with, or null.

Returns

bool

true when obj is an equal QueryPlan.

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.