Pragmatic.Events
1.0.0-alpha.2
See the version list below for details.
dotnet add package Pragmatic.Events --version 1.0.0-alpha.2
NuGet\Install-Package Pragmatic.Events -Version 1.0.0-alpha.2
<PackageReference Include="Pragmatic.Events" Version="1.0.0-alpha.2" />
<PackageVersion Include="Pragmatic.Events" Version="1.0.0-alpha.2" />
<PackageReference Include="Pragmatic.Events" />
paket add Pragmatic.Events --version 1.0.0-alpha.2
#r "nuget: Pragmatic.Events, 1.0.0-alpha.2"
#:package Pragmatic.Events@1.0.0-alpha.2
#addin nuget:?package=Pragmatic.Events&version=1.0.0-alpha.2&prerelease
#tool nuget:?package=Pragmatic.Events&version=1.0.0-alpha.2&prerelease
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, not
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
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 | Versions 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. |
-
net10.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.10)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.10)
- Pragmatic.Abstractions (>= 1.0.0-alpha.2)
- Pragmatic.Ensure (>= 1.0.0-alpha.2)
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 |