Skip to main content

IQueryExecutor

  • Namespace: PPDS.Dataverse.Query
  • Assembly: PPDS.Dataverse
  • Kind: Interface

Summary

Executes FetchXML queries against Dataverse and returns structured results.

Members

Methods

ExecuteFetchXmlAllPagesAsync

Task<QueryResult> ExecuteFetchXmlAllPagesAsync(string fetchXml, int maxRecords, CancellationToken cancellationToken)

Executes a FetchXML query with automatic paging, returning all results. Use with caution for large result sets.

  • Param fetchXml: The FetchXML query to execute.

  • Param maxRecords: Maximum total records to retrieve. Default is 5000.

  • Param cancellationToken: Cancellation token.

  • Returns: The query result containing all records up to maxRecords.

ExecuteFetchXmlAsync

Task<QueryResult> ExecuteFetchXmlAsync(string fetchXml, Nullable<int> pageNumber, string pagingCookie, bool includeCount, CancellationToken cancellationToken)

Executes a FetchXML query and returns the results.

  • Param fetchXml: The FetchXML query to execute.

  • Param pageNumber: Optional page number for paging (1-based). If null, uses page 1.

  • Param pagingCookie: Optional paging cookie from a previous query result for continuation.

  • Param includeCount: Whether to include the total record count in the result.

  • Param cancellationToken: Cancellation token.

  • Returns: The query result containing records, columns, and paging information.

ExecuteFetchXmlAsync

Task<QueryResult> ExecuteFetchXmlAsync(string fetchXml, Nullable<int> pageNumber, string pagingCookie, bool includeCount, QueryExecutionOptions executionOptions, CancellationToken cancellationToken)

Executes a FetchXML query with optional execution options (bypass plugins/flows). Default implementation ignores execution options and delegates to the base overload. Override in concrete classes to apply PPDS.Dataverse.Query.QueryExecutionOptions.

GetMinMaxCreatedOnAsync

Task<ValueTuple<Nullable<DateTime>, Nullable<DateTime>>> GetMinMaxCreatedOnAsync(string entityLogicalName, CancellationToken cancellationToken)

Gets the min and max createdon dates for an entity, used for aggregate partitioning.

  • Param entityLogicalName: The logical name of the entity.

  • Param cancellationToken: Cancellation token.

  • Returns: A tuple of (Min, Max) DateTime values, or (null, null) if not available.

GetTotalRecordCountAsync

Task<Nullable<long>> GetTotalRecordCountAsync(string entityLogicalName, CancellationToken cancellationToken)

Gets the total record count for an entity using RetrieveTotalRecordCountRequest. This is a near-instant metadata read, not a full table scan.

  • Param entityLogicalName: The logical name of the entity to count.

  • Param cancellationToken: Cancellation token.

  • Returns: The total count, or null if not supported for this entity.