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
NameFullyQualifiedQueryNameThe name of the query.
CorrelationIdCorrelationIdThe CorrelationId for the query.
PagingPagingThe Paging information.
SortingSortingThe Sorting information.
ArgumentsQueryArgumentsOptional arguments for the query.
DependenciesIEnumerable<object>Optional dependencies required to handle the query.
ServiceProviderIServiceProviderThe IServiceProvider scoped to the query, used to resolve scoped collaborators such as validators during the query's lifetime.
CancellationTokenCancellationTokenThe cancellation token for the query, so a cancelled request is not mistaken for invalid input.
QueryContext(QueryContext)
protected QueryContext(QueryContext original)
Parameters
originalQueryContext
Fields
NotSet
Represents a query context that is not set.
public static readonly QueryContext NotSet
Field Value
Properties
Arguments
Optional arguments for the query.
public QueryArguments? Arguments { get; init; }
Property Value
AuthorizedPrincipal
Gets the principal selected during authorization, for a long-lived subscription's identity snapshot.
public ClaimsPrincipal? AuthorizedPrincipal { get; }
Property Value
CancellationToken
The cancellation token for the query, so a cancelled request is not mistaken for invalid input.
public CancellationToken CancellationToken { get; init; }
Property Value
CorrelationId
The CorrelationId for the query.
public CorrelationId CorrelationId { get; init; }
Property Value
Dependencies
Optional dependencies required to handle the query.
public IEnumerable<object>? Dependencies { get; init; }
Property Value
EqualityContract
protected virtual Type EqualityContract { get; }
Property Value
Name
The name of the query.
public FullyQualifiedQueryName Name { get; init; }
Property Value
Paging
The Paging information.
public Paging Paging { get; init; }
Property Value
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
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
Sorting
The Sorting information.
public Sorting Sorting { get; init; }
Property Value
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
TotalItems
Gets or sets the total number of items in the query.
public int TotalItems { get; set; }
Property Value
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
NameFullyQualifiedQueryNameCorrelationIdCorrelationIdPagingPagingSortingSortingArgumentsQueryArgumentsDependenciesIEnumerable<object>ServiceProviderIServiceProviderCancellationTokenCancellationToken
Equals(QueryContext?)
public virtual bool Equals(QueryContext? other)
Parameters
otherQueryContext
Returns
Equals(object?)
public override bool Equals(object? obj)
Parameters
objobject
Returns
GetHashCode()
public override int GetHashCode()
Returns
PrintMembers(StringBuilder)
protected virtual bool PrintMembers(StringBuilder builder)
Parameters
builderStringBuilder
Returns
ToString()
public override string ToString()
Returns
Operators
operator ==(QueryContext?, QueryContext?)
public static bool operator ==(QueryContext? left, QueryContext? right)
Parameters
leftQueryContextrightQueryContext
Returns
operator !=(QueryContext?, QueryContext?)
public static bool operator !=(QueryContext? left, QueryContext? right)
Parameters
leftQueryContextrightQueryContext