Skip to main content

FetchXmlScanNode

  • Namespace: PPDS.Dataverse.Query.Planning.Nodes
  • Assembly: PPDS.Dataverse
  • Kind: Class
  • Implements: IQueryPlanNode

Summary

Executes a FetchXML query and yields rows page-by-page. Leaf node in the execution plan tree.

Members

Constructors

FetchXmlScanNode(string fetchXml, string entityLogicalName, bool autoPage, Nullable<int> maxRows, Nullable<int> initialPageNumber, string initialPagingCookie, bool includeCount, bool noLock)

FetchXmlScanNode(string fetchXml, string entityLogicalName, bool autoPage, Nullable<int> maxRows, Nullable<int> initialPageNumber, string initialPagingCookie, bool includeCount, bool noLock)

Initializes a new instance of the PPDS.Dataverse.Query.Planning.Nodes.FetchXmlScanNode class.

Methods

ExecuteAsync

IAsyncEnumerable<QueryRow> ExecuteAsync(QueryPlanContext context, CancellationToken cancellationToken)

Execute this node, producing rows.

SetLastParentId

void SetLastParentId(Guid parentId)

Records the primary key of the last parent record on the current page. Called at the end of each page when PPDS.Dataverse.Query.Planning.Nodes.FetchXmlScanNode.HasLinkedEntity is true to enable boundary split detection on the next page.

  • Param parentId: The primary key of the last parent record on the current page.

ShouldMergeWithPreviousPage

bool ShouldMergeWithPreviousPage(Guid firstParentId)

Determines whether the first record on a new page should be merged with the last parent from the previous page, rather than treated as a new parent. This occurs when a parent record's child rows span a page boundary.

  • Param firstParentId: The primary key of the first parent record on the new page.

  • Returns: true if the record is a continuation of a parent from the previous page and its child records should be merged; false otherwise.

Properties

AutoPage

bool AutoPage { get; }

If true, automatically fetch all pages. If false, single page only.

Children

IReadOnlyList<IQueryPlanNode> Children { get; }

Child nodes (inputs to this operator).

Description

string Description { get; }

Human-readable description for EXPLAIN output.

EntityLogicalName

string EntityLogicalName { get; }

The entity logical name being queried.

EstimatedRows

long EstimatedRows { get; }

Estimated row count (for cost-based decisions). -1 if unknown.

FetchXml

string FetchXml { get; }

The FetchXML query to execute.

HasLinkedEntity

bool HasLinkedEntity { get; }

Indicates whether the FetchXML query contains link-entity elements. When true, pagination may split a parent record's children across page boundaries, requiring merge logic to avoid duplicate parents with incomplete child sets.

IncludeCount

bool IncludeCount { get; }

Whether to request total record count from Dataverse.

InitialPageNumber

Nullable<int> InitialPageNumber { get; }

Starting page number for caller-controlled paging (1-based). When set with PPDS.Dataverse.Query.Planning.Nodes.FetchXmlScanNode.AutoPage = false, fetches only this page.

InitialPagingCookie

string InitialPagingCookie { get; }

Paging cookie for caller-controlled paging continuation.

MaxRows

Nullable<int> MaxRows { get; }

Maximum rows to return, if any.

NoLock

bool NoLock { get; }

Whether to inject no-lock="true" into the FetchXML before execution.