Class QueryContext

Namespace
Cratis.Arc.Queries
Assembly
Cratis.Arc.Core.dll

Defines the context for a query.

public record QueryContext : IEquatable<QueryContext>
Inheritance
QueryContext
Implements
Inherited Members
Extension Methods

Constructors

QueryContext(FullyQualifiedQueryName, CorrelationId, Paging, Sorting, QueryArguments?, IEnumerable<object>?, IServiceProvider?, CancellationToken)

Defines the context for a query.

public QueryContext(FullyQualifiedQueryName Name, CorrelationId CorrelationId, Paging Paging, Sorting Sorting, QueryArguments? Arguments = null, IEnumerable<object>? Dependencies = null, IServiceProvider? ServiceProvider = null, CancellationToken CancellationToken = default)

Parameters

Name FullyQualifiedQueryName

The name of the query.

CorrelationId CorrelationId

The CorrelationId for the query.

Paging Paging

The Paging information.

Sorting Sorting

The Sorting information.

Arguments QueryArguments

Optional arguments for the query.

Dependencies IEnumerable<object>

Optional dependencies required to handle the query.

ServiceProvider IServiceProvider

The IServiceProvider scoped to the query, used to resolve scoped collaborators such as validators during the query's lifetime.

CancellationToken CancellationToken

The cancellation token for the query, so a cancelled request is not mistaken for invalid input.

QueryContext(QueryContext)

protected QueryContext(QueryContext original)

Parameters

original QueryContext

Fields

NotSet

Represents a query context that is not set.

public static readonly QueryContext NotSet

Field Value

QueryContext

Properties

Arguments

Optional arguments for the query.

public QueryArguments? Arguments { get; init; }

Property Value

QueryArguments

AuthorizedPrincipal

Gets the principal selected during authorization, for a long-lived subscription's identity snapshot.

public ClaimsPrincipal? AuthorizedPrincipal { get; }

Property Value

ClaimsPrincipal

CancellationToken

The cancellation token for the query, so a cancelled request is not mistaken for invalid input.

public CancellationToken CancellationToken { get; init; }

Property Value

CancellationToken

CorrelationId

The CorrelationId for the query.

public CorrelationId CorrelationId { get; init; }

Property Value

CorrelationId

Dependencies

Optional dependencies required to handle the query.

public IEnumerable<object>? Dependencies { get; init; }

Property Value

IEnumerable<object>

EqualityContract

protected virtual Type EqualityContract { get; }

Property Value

Type

Name

The name of the query.

public FullyQualifiedQueryName Name { get; init; }

Property Value

FullyQualifiedQueryName

Paging

The Paging information.

public Paging Paging { get; init; }

Property Value

Paging

ReceivedAt

Gets the time Arc received this query operation. Model-bound dispatch captures it before binding and authorization preparation; MVC action filters capture it after MVC binding. This is neither network arrival nor time before application middleware. A hand-constructed context has default unless the caller sets this property.

public DateTimeOffset ReceivedAt { get; init; }

Property Value

DateTimeOffset

ServiceProvider

The IServiceProvider scoped to the query, used to resolve scoped collaborators such as validators during the query's lifetime.

public IServiceProvider? ServiceProvider { get; init; }

Property Value

IServiceProvider

Sorting

The Sorting information.

public Sorting Sorting { get; init; }

Property Value

Sorting

SubscriptionScope

Gets or sets the serializable effective scope selected by a query filter for this subscription. An absent scope is null.

public object? SubscriptionScope { get; set; }

Property Value

object

TotalItems

Gets or sets the total number of items in the query.

public int TotalItems { get; set; }

Property Value

int

Methods

Deconstruct(out FullyQualifiedQueryName, out CorrelationId, out Paging, out Sorting, out QueryArguments?, out IEnumerable<object>?, out IServiceProvider?, out CancellationToken)

public void Deconstruct(out FullyQualifiedQueryName Name, out CorrelationId CorrelationId, out Paging Paging, out Sorting Sorting, out QueryArguments? Arguments, out IEnumerable<object>? Dependencies, out IServiceProvider? ServiceProvider, out CancellationToken CancellationToken)

Parameters

Name FullyQualifiedQueryName
CorrelationId CorrelationId
Paging Paging
Sorting Sorting
Arguments QueryArguments
Dependencies IEnumerable<object>
ServiceProvider IServiceProvider
CancellationToken CancellationToken

Equals(QueryContext?)

public virtual bool Equals(QueryContext? other)

Parameters

other QueryContext

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

PrintMembers(StringBuilder)

protected virtual bool PrintMembers(StringBuilder builder)

Parameters

builder StringBuilder

Returns

bool

ToString()

public override string ToString()

Returns

string

Operators

operator ==(QueryContext?, QueryContext?)

public static bool operator ==(QueryContext? left, QueryContext? right)

Parameters

left QueryContext
right QueryContext

Returns

bool

operator !=(QueryContext?, QueryContext?)

public static bool operator !=(QueryContext? left, QueryContext? right)

Parameters

left QueryContext
right QueryContext

Returns

bool