Memoria

Overview

Memoria is two libraries in one. You can use it as:

  1. A mediator — dispatch commands, queries, and notifications with a single IDispatcher and no further infrastructure.
  2. A full event-sourcing solution — persist domain events, reconstruct aggregates, and project state with one of several store providers.

These two modes share the same core. You can start with the mediator and add event sourcing later without rewriting handlers.

Mediator mode

Three kinds of requests flow through the dispatcher:

Kind Interface Handlers per request Returns
Command ICommand one Result or Result<T>
Query IQuery<T> one Result<T>
Notification INotification many (fan-out) Result per handler

Every handler returns a Result — failures travel through the type system, not exceptions. See Configuration: Memoria Core for the one line of DI registration.

Event sourcing mode

On top of the mediator, Memoria adds aggregates, streams, and an IDomainService API:

The actual storage is pluggable. See Providers for the matrix.

When to use what