Skip to content

SQL Server

Kieron Lanning edited this page Apr 16, 2026 · 1 revision

SQL Server

This page is the wiki summary for the SQL Server provider pair:

  • EventSourcing.SqlServer.Events
  • EventSourcing.SqlServer.Snapshot

The repository also contains a fuller in-repo guide at docs/sql-server.md.

Registration

builder.Services.AddSqlServerEventStore();
builder.Services.AddSqlServerSnapshotQueryableEventStore();

Configuration

The providers look for a SQL Server connection string. In the sample app, the primary path is:

{
  "ConnectionStrings": {
    "eventstore-sqlserver": "Server=.;Database=MyApp;Trusted_Connection=True;"
  }
}

What each package does

Package Purpose
EventSourcing.SqlServer.Events Event stream persistence
EventSourcing.SqlServer.Snapshot Queryable snapshots, filtering, paging, and list/count support

When to use both

Use both packages together when your application:

  • persists events as the source of truth
  • also needs query/list/count APIs
  • wants administration or back-office pages over aggregate state

That is exactly how the sample web app is configured.

Operational notes

  • Tables can be auto-created depending on configuration.
  • Queryable snapshots are the ergonomic choice for non-generic IQueryableEventStore usage.
  • Native transaction coordination is possible when all enlisted stores share the same provider boundary.

For deeper details on permissions, table layout, routing, and versioning, use the repository doc: docs/sql-server.md.

Clone this wiki locally