Table of Contents

Class EntityContinuationQuery<TReadModel>

Namespace
Arbiter.CommandQuery.Queries
Assembly
Arbiter.CommandQuery.dll

Represents a query for retrieving paged entities using a continuation token based on an EntitySelect. The result of the query will be of type EntityContinuationResult<TReadModel>.

public record EntityContinuationQuery<TReadModel> : CacheableQueryBase<EntityContinuationResult<TReadModel>>, IRequest<EntityContinuationResult<TReadModel>>, IRequest, IEquatable<PrincipalCommandBase<EntityContinuationResult<TReadModel>>>, IEquatable<PrincipalQueryBase<EntityContinuationResult<TReadModel>>>, ICacheResult, IEquatable<CacheableQueryBase<EntityContinuationResult<TReadModel>>>, IEquatable<EntityContinuationQuery<TReadModel>>

Type Parameters

TReadModel

The type of the read model returned as the result of the query.

Inheritance
EntityContinuationQuery<TReadModel>
Implements
Inherited Members

Examples

The following example demonstrates how to use the EntityContinuationQuery<TReadModel>:

var principal = new ClaimsPrincipal(new ClaimsIdentity(new[] { new Claim(ClaimTypes.Name, "JohnDoe") }));
var entitySelect = new EntitySelect
{
    Filter = new EntityFilter { Name = "Status", Operator = "eq", Value = "Active" },
    Sort = new List<EntitySort> { new EntitySort { Name = "Name", Direction = "asc" } }
};

var query = new EntityContinuationQuery<ProductReadModel>(principal, entitySelect, pageSize: 20, continuationToken: "abc123");

// Send the query to the mediator instance
var result = await mediator.Send(query);
Console.WriteLine($"Continuation Token: {result?.ContinuationToken}");

Remarks

This query is typically used in scenarios where data needs to be retrieved in pages, with each page being identified by a continuation token. The EntitySelect allows filtering and sorting of the data.

Constructors

EntityContinuationQuery(ClaimsPrincipal?, EntitySelect?, int, string?)

Initializes a new instance of the EntityContinuationQuery<TReadModel> class.

public EntityContinuationQuery(ClaimsPrincipal? principal, EntitySelect? query, int pageSize = 10, string? continuationToken = null)

Parameters

principal ClaimsPrincipal

The ClaimsPrincipal representing the user executing the query.

query EntitySelect

The EntitySelect defining the filter and sort criteria for the query.

pageSize int

The number of items to retrieve per page.

continuationToken string

The continuation token for retrieving the next page of results.

Properties

ContinuationToken

Gets the continuation token for retrieving the next page of results.

[JsonPropertyName("continuationToken")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? ContinuationToken { get; }

Property Value

string

PageSize

Gets the number of items to retrieve per page.

[JsonPropertyName("pageSize")]
public int PageSize { get; }

Property Value

int

Query

Gets the EntitySelect defining the filter and sort criteria for the query.

[JsonPropertyName("query")]
public EntitySelect Query { get; }

Property Value

EntitySelect

Methods

GetCacheKey()

Gets the cache key for this query instance.

public override string GetCacheKey()

Returns

string

A string representing the cache key.

GetCacheTag()

Gets the cache tag for this query instance.

public override string? GetCacheTag()

Returns

string

A string representing the cache tag, or null if not set.