Pragmatic.Events 1.0.0-alpha.6

This is a prerelease version of Pragmatic.Events.
dotnet add package Pragmatic.Events --version 1.0.0-alpha.6
                    
NuGet\Install-Package Pragmatic.Events -Version 1.0.0-alpha.6
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Pragmatic.Events" Version="1.0.0-alpha.6" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Pragmatic.Events" Version="1.0.0-alpha.6" />
                    
Directory.Packages.props
<PackageReference Include="Pragmatic.Events" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Pragmatic.Events --version 1.0.0-alpha.6
                    
#r "nuget: Pragmatic.Events, 1.0.0-alpha.6"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Pragmatic.Events@1.0.0-alpha.6
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Pragmatic.Events&version=1.0.0-alpha.6&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Pragmatic.Events&version=1.0.0-alpha.6&prerelease
                    
Install as a Cake Tool

Pragmatic.Events

Domain events for .NET 10: raise, dispatch, and handle with zero ceremony, including an EF Core interceptor for automatic post-SaveChanges dispatch.

The Problem

As modules grow they need to react to each other. Confirm a reservation and billing must invoice, notifications must email, audit must log. Direct calls couple the entity to every downstream service, force you to edit the entity for each new reaction, and let a non-critical failure (email) break the core operation.

public async Task ConfirmAsync()
{
    Status = ReservationStatus.Confirmed;
    await _billing.CreateDraftInvoiceAsync(Id, GuestId, TotalAmount, Currency);
    await _notifications.SendConfirmationEmailAsync(GuestId, Id);   // failure here breaks confirm
}

The Solution

The entity raises an event describing what happened; handlers in other boundaries subscribe and react independently: no coupling, no edits when a new consumer appears, and isolated failure handling.

public VoidResult<IError> Confirm()
{
    var result = TransitionTo(ReservationStatus.Confirmed);
    if (result.IsSuccess) RaiseEvent(new ReservationConfirmed(Id, GuestId, PropertyId));
    return result;
}

[EventHandler]
public sealed class CreateInvoiceOnConfirm : IDomainEventHandler<ReservationConfirmed>
{
    public Task HandleAsync(ReservationConfirmed e, CancellationToken ct) => /* ... */;
}

The generator registers every [EventHandler] class (PRAG1670 if it implements no IDomainEventHandler<T>); the EF Core interceptor dispatches after a successful SaveChanges. Ordering and continue-on-failure are built in. When you need crash-safe, at-least-once delivery, put [EnableEventOutbox] on the boundary: its events are then written to the transactional outbox in the same transaction as the entity change and delivered asynchronously (at-least-once: handlers must be idempotent). The outbox ships in Pragmatic.Events.EFCore, and in Pragmatic.Events.Engines for a boundary on the Sql or documents engine, not in Pragmatic.Messaging. Add Messaging only for cross-service delivery over a broker.

Installation

dotnet add package Pragmatic.Events
dotnet add package Pragmatic.Events.EFCore   # post-SaveChanges interceptor dispatch
dotnet add package Pragmatic.Events.Engines  # the outbox on the Sql and documents engines

Status

Functional within 1.0.0-alpha: raise, dispatch and handle, handler ordering, continue-on-failure, declarative lifecycle events ([Raises<T>]), the EF Core interceptor, and the transactional outbox. See the roadmap.

Documentation

Guide What you'll learn
Concepts Raise/subscribe model, dispatch timing, ordering, transactional outbox
Getting Started Raise an event, write a handler, wire the interceptor, lifecycle [Raises<T>], outbox
Internals Interceptor lifecycle, typed dispatch table, outbox mechanics, observability
Common Mistakes The most frequent event pitfalls
Troubleshooting Problem/solution guide

Requirements

  • .NET 10.0+

License

Part of the Pragmatic.Design ecosystem. See Licensing. Pragmatic.Events is licensed under the PolyForm Small Business 1.0.0 license (free for small businesses; commercial license above the threshold).

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed.  net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (8)

Showing the top 5 NuGet packages that depend on Pragmatic.Events:

Package Downloads
Pragmatic.Actions

DomainAction pattern with Pipeline, Filters, and Boundary support. Zero reflection, compile-time safe, source-generated.

Pragmatic.Messaging

Messaging bridge: outbox delivery service, event adapter. Depends on Events; the EF Core outbox capture is in Pragmatic.Messaging.EFCore. Core types are in Pragmatic.Messaging.Core.

Pragmatic.Events.EFCore

EF Core integration for Pragmatic.Events: SaveChangesInterceptor for automatic domain event dispatch.

Pragmatic.Authorization.Management

RBAC management package for Pragmatic.Design. Dynamic permissions, roles, groups, and user assignments, persisted by the engine of the boundary that imports it: with Pragmatic.Authorization.Management.EFCore on EF Core, with Pragmatic.Authorization.Management.Engines on the Sql and documents engines.

Pragmatic.Persistence.Engines

What the bridges of Pragmatic's persistence engines other than EF Core share: how a filter of an entity is decided, the phases a unit of work's save runs, the registry of compiled data scope rules, a grid's page.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0-alpha.6 306 11/21/2026
1.0.0-alpha.5 239 11/21/2026
1.0.0-alpha.4 294 11/16/2026
1.0.0-alpha.3 660 10/17/2026
1.0.0-alpha.2 238 10/12/2026
1.0.0-alpha.1 453 10/3/2026