Table of Contents

Interface IAggregateQuery<TAggregate>

Namespace
Excalibur.EventSourcing
Assembly
Excalibur.EventSourcing.Abstractions.dll

Marker interface for aggregate query objects.

public interface IAggregateQuery<TAggregate> where TAggregate : class, IAggregateRoot

Type Parameters

TAggregate

The aggregate type this query targets.

Examples

// Define a query for finding users by status
public record GetUsersByStatusQuery(UserStatus Status) : IAggregateQuery<UserAggregate>;

// Execute the query
var activeUsers = await repository.QueryAsync(new GetUsersByStatusQuery(UserStatus.Active));

// Find single aggregate
var admin = await repository.FindAsync(new GetUserByRoleQuery(UserRole.Administrator));

Remarks

Implement this interface for type-safe queries against aggregate repositories. Query objects define their own criteria properties and are executed via EventSourcedRepository.QueryAsync or EventSourcedRepository.FindAsync on the concrete repository class.

This is a marker interface - no methods are required. Derived queries define their own criteria properties based on the specific query requirements.