What problem does it solve?
Query-side projections in event-driven .NET systems must process events in order and tolerate duplicates; without clear patterns handlers can produce inconsistent read models, lost updates, or unnecessary retries.
Core Features & Use Cases
- Idempotent creations: creation handlers detect existing entities and return success to avoid duplicate processing.
- Strict sequence validation: update handlers enforce sequence == event.Sequence - 1 to detect gaps and out-of-order delivery and return appropriate completion or retry signals.
- Unit of Work and named repositories: encourages IUnitOfWork with named repository properties and cancellation-aware persistence to ensure consistent commits.
- Message-level return semantics: handlers return boolean to indicate completion (true) or retry/abandon (false), suitable for Service Bus or queue-based retry policies.
- Use Case: building reliable query projections for Orders and Products that survive duplicates, replays, and eventual delivery ordering.
Quick Start
Implement an event handler that returns true for already processed or successfully applied events, returns false when prior events are missing, uses IUnitOfWork with named repositories, performs strict sequence checks before applying behavior, and calls SaveChangesAsync with the provided cancellation token.