Xpandables.Events.Data
10.0.1
See the version list below for details.
dotnet add package Xpandables.Events.Data --version 10.0.1
NuGet\Install-Package Xpandables.Events.Data -Version 10.0.1
<PackageReference Include="Xpandables.Events.Data" Version="10.0.1" />
<PackageVersion Include="Xpandables.Events.Data" Version="10.0.1" />
<PackageReference Include="Xpandables.Events.Data" />
paket add Xpandables.Events.Data --version 10.0.1
#r "nuget: Xpandables.Events.Data, 10.0.1"
#:package Xpandables.Events.Data@10.0.1
#addin nuget:?package=Xpandables.Events.Data&version=10.0.1
#tool nuget:?package=Xpandables.Events.Data&version=10.0.1
System.Events.Data
ADO.NET persistence for event sourcing with System.Events.
Overview
System.Events.Data provides ADO.NET implementations for the event store, outbox, and inbox abstractions defined in System.Events. It uses System.Data (IDataRepository, IDataUnitOfWork) for raw ADO.NET persistence with SQL scripts for table creation across SQL Server, PostgreSQL, and SQLite.
Built for .NET 10. Does not use Entity Framework Core.
Features
Event Store
EventStore<TDomain, TSnapshot>— ADO.NET event store implementingIEventStore- Supports append, read, subscribe, truncate, and delete stream operations
Outbox/Inbox Stores
OutboxStore<TOutbox>— ADO.NET outbox implementingIOutboxStoreInboxStore<TInbox>— ADO.NET inbox implementingIInboxStore
Data Entities
DataEvent— Base entity for event recordsDataEventDomain— Domain event entity (IDataEventDomain)DataEventSnapshot— Snapshot event entity (IDataEventSnapshot)DataEventOutbox— Outbox event entity (IDataEventOutbox)DataEventInbox— Inbox event entity (IDataEventInbox)
Event Converters
IEventConverter<TDataEvent, TEvent>— Convert between data entities and event typesIEventConverterFactory— Factory for obtaining convertersEventConverterFactory— Default factory implementationEventConverterDomain— Domain event converterEventConverterSnapshot— Snapshot event converterEventConverterOutbox— Outbox event converterEventConverterInbox— Inbox event converterIEventConverterContext— Shared context for convertersDefaultEventConverterContext— Default converter context
SQL Scripts
IEventTableScriptProvider— Provides SQL scripts for creating/dropping event tablesSqlServerEventTableScripts— SQL Server table scriptsPostgreSqlEventTableScripts— PostgreSQL table scriptsSqliteEventTableScripts— SQLite table scriptsEventTableScriptExporter— Export scripts to files
Installation
dotnet add package Xpandables.Events.Data
Dependencies: System.Events, System.Data
Quick Start
Register Services
using Microsoft.Extensions.DependencyInjection;
// Register all event stores (EventStore, OutboxStore, InboxStore)
services.AddXEventStores();
// Or register individually
services.AddXEventStore();
services.AddXOutboxStore();
services.AddXInboxStore();
// Register converter factory and context
services.AddXEventConverterFactory();
services.AddXEventConverterContext();
Create Database Tables
using System.Events.Data.Scripts;
// Get SQL scripts for your database
var scripts = new SqlServerEventTableScripts();
string createScript = scripts.GetCreateAllTablesScript(schema: "Events");
string dropScript = scripts.GetDropAllTablesScript(schema: "Events");
// Or use PostgreSQL/SQLite
var pgScripts = new PostgreSqlEventTableScripts();
var sqliteScripts = new SqliteEventTableScripts();
Use the Event Store
using System.Events.Domain;
using System.Events.Data;
public class OrderService(IEventStore eventStore)
{
public async Task CreateOrderAsync(
Guid orderId, CancellationToken ct)
{
var request = new AppendRequest
{
StreamId = orderId,
Events = [new OrderCreated { StreamId = orderId }]
};
AppendResult result = await eventStore
.AppendToStreamAsync(request, ct);
}
public async Task<List<IDomainEvent>> GetEventsAsync(
Guid streamId, CancellationToken ct)
{
var request = new ReadStreamRequest
{
StreamId = streamId,
FromVersion = 0
};
var events = new List<IDomainEvent>();
await foreach (var envelope in eventStore
.ReadStreamAsync(request, ct))
{
events.Add(envelope.Event);
}
return events;
}
}
Core Types
| Type | Description |
|---|---|
EventStore<TDomain, TSnapshot> |
ADO.NET event store |
OutboxStore<TOutbox> |
ADO.NET outbox store |
InboxStore<TInbox> |
ADO.NET inbox store |
DataEventDomain |
Domain event data entity |
DataEventSnapshot |
Snapshot data entity |
DataEventOutbox |
Outbox data entity |
DataEventInbox |
Inbox data entity |
IEventConverterFactory |
Converter factory |
IEventTableScriptProvider |
SQL script provider |
DI Extension Methods
| Method | Description |
|---|---|
AddXEventStores() |
Register all stores (EventStore, Outbox, Inbox) |
AddXEventStore() |
Register EventStore only |
AddXOutboxStore() |
Register OutboxStore only |
AddXInboxStore() |
Register InboxStore only |
AddXEventConverterFactory() |
Register event converter factory |
AddXEventConverterContext() |
Register default converter context |
📚 Related Packages
| Package | Description |
|---|---|
| Xpandables.Events | Core event sourcing abstractions |
| Xpandables.Data | ADO.NET repository and unit of work |
📄 License
Apache License 2.0 — Copyright © Kamersoft 2025
| 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.Configuration (>= 10.0.3)
- Microsoft.Extensions.Configuration.EnvironmentVariables (>= 10.0.3)
- Microsoft.Extensions.Configuration.Json (>= 10.0.3)
- Microsoft.Extensions.DependencyInjection (>= 10.0.3)
- Microsoft.Extensions.Hosting (>= 10.0.3)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.3)
- Microsoft.Extensions.Options (>= 10.0.3)
- Microsoft.Extensions.Primitives (>= 10.0.3)
- Xpandables.Data (>= 10.0.1)
- Xpandables.Events (>= 10.0.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Xpandables.Events.Data:
| Package | Downloads |
|---|---|
|
Xpandables.AspNetCore.Events
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.