Memoria

Memoria is a .NET framework for DDD, CQRS and Event Sourcing. Use it as a plain mediator — commands, queries and notifications behind one dispatcher — or as an event store, with classic event streams or with dynamic consistency boundaries where the boundary is a tag query chosen per decision.

dotnet add package Memoria

Where to start

You want to… Start at
Dispatch commands and queries, nothing more Quickstart: Mediator
Save and rebuild aggregates from events Quickstart: Event Sourcing
Understand what the pieces are before writing any Concepts: Overview
Decide how to model consistency Streams or DCB?
Look up an API or a settings key Reference
Read a store you already have Memoria Web, a separate tool
Move from an earlier version Upgrading

Everything is in the sidebar too: Guides for a task you already know you want to do, Concepts for why things are shaped the way they are, and Reference for looking something up.

What it does

  • Mediator — commands, queries and notifications, each with a handler, each returning a Result rather than throwing. Command sequences, custom handlers and automatic notification publication come with it.
  • Two consistency models — event streams with optimistic concurrency, or dynamic consistency boundaries. Multiple aggregates can share one stream.
  • Snapshots that stay consistent — an aggregate’s snapshot is stored alongside its events, so a read is fast without being stale. Projections are persisted the same way.
  • Four read modes — snapshot only, snapshot with new events, and the create-if-missing variants of both.
  • Providers for everything external — Entity Framework Core and Cosmos DB for storage, Azure Service Bus and RabbitMQ for messaging, in-process and Redis for caching, FluentValidation for validation. Each has an in-memory variant so tests need nothing running.

Elsewhere

  • Repository · Examples · Release notes
  • Licence — the framework is Apache 2.0; Memoria Web is a separate commercial product, free for one service
  • Memoria Web — the browser tool for reading a store, developed in its own repository and being made to read any framework’s store; a hosted demo is open by invitation
  • Contributing