EventStorage 0.0.0-beta.15
dotnet add package EventStorage --version 0.0.0-beta.15
NuGet\Install-Package EventStorage -Version 0.0.0-beta.15
<PackageReference Include="EventStorage" Version="0.0.0-beta.15" />
paket add EventStorage --version 0.0.0-beta.15
#r "nuget: EventStorage, 0.0.0-beta.15"
// Install EventStorage as a Cake Addin #addin nuget:?package=EventStorage&version=0.0.0-beta.15&prerelease // Install EventStorage as a Cake Tool #tool nuget:?package=EventStorage&version=0.0.0-beta.15&prerelease
eventstorage
A lightweight event sourcing framework for .NET with event storage of choice.
Overview
eventstorage is a high-performance framework powered by latest innovative C# that allows selecting event storage of choice with Azure Sql, Postgres and Sql Server, and offers multiple projection modes with support to Redis for high-performance asynchronous projections.
es denormalizes and uses a flexible schema, running everything through plain sql resulting in lightning-fast storage operations.
Prerequisites
eventstorage runs on the stable release of .NET 8 and requires the SDK installed.
https://dotnet.microsoft.com/en-us/download/dotnet/8.0
Use docker to run mssql or postgres databases, execute docker-compose
or docker run
:
docker compose --project-name eventstorage up -d
Postgres
docker run --name some-postgres -p 5432:5432 -e POSTGRES_PASSWORD=postgres -d postgres
Sql Server
docker run --name some-mssql -p 1433:1433 -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=sysadmin@1234" -d mcr.microsoft.com/mssql/server:2019-latest
Optionally run Redis
for high-performance projections:
docker run -d --name redis-stack -p 6379:6379 -p 8001:8001 redis/redis-stack:latest
Usage
Simply install EventStorage
package.
dotnet add package EventStorage --prerelease
Use AddEventStorage
service collection extension.
builder.Services.AddEventStorage(eventstorage =>
{
eventstorage.Schema = "es";
eventstorage.AddEventSource(source =>
{
eventsource.Select(EventStore.PostgresSql, connectionString)
.Project<OrderProjection>(ProjectionMode.Consistent)
.Project<OrderDocumentProjection>(ProjectionMode.Async, source => source.Redis("redis://localhost"));
});
});
Use configuration options to select event storage of choice and make sure connection string is defined.
Create aggregate root
Add your aggregate with EventSource<TId>
public class OrderBooking : EventSource<long> // or Guid
{
public OrderStatus OrderStatus { get; private set; }
public void Apply(OrderPlaced e)
{
OrderStatus = OrderStatus.Placed;
}
public void PlaceOrder(PlaceOrder command)
{
if(OrderStatus == OrderStatus.Placed)
return;
RaiseEvent(new OrderPlaced(command));
}
}
EventSource<TId>
allows selecting long
or Guid
to identify event streams.
While selecting long
offers lightnening-fast queries and is human readable, we can always switch back and forth between the two!
To continue please visit our GitHub or our beautiful documentation site.
Give us a star ⭐
If you are an event sourcer and love OSS, give eventstorage a star. 💜
License
This project is licensed under the terms of MIT license.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net8.0
- Microsoft.Data.SqlClient (>= 5.2.1)
- Microsoft.Extensions.DependencyInjection (>= 8.0.0)
- Microsoft.Extensions.Hosting (>= 8.0.0)
- Microsoft.Extensions.Logging (>= 8.0.0)
- Npgsql (>= 8.0.4)
- Redis.OM (>= 0.7.5)
- TDiscover (>= 0.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.0.0-beta.15 | 39 | 2/3/2025 |
0.0.0-beta.14 | 36 | 1/19/2025 |
0.0.0-beta.13 | 79 | 12/13/2024 |
0.0.0-beta.12 | 53 | 12/10/2024 |
0.0.0-beta.11 | 52 | 12/2/2024 |
0.0.0-beta.10 | 57 | 12/1/2024 |
0.0.0-beta.9 | 62 | 11/26/2024 |
0.0.0-beta.8 | 59 | 11/26/2024 |
0.0.0-beta.7 | 57 | 11/24/2024 |
0.0.0-beta.6 | 56 | 11/23/2024 |
0.0.0-beta.5 | 57 | 11/22/2024 |
0.0.0-beta.4 | 50 | 11/20/2024 |
0.0.0-beta.3 | 49 | 11/18/2024 |
0.0.0-beta.2 | 52 | 11/17/2024 |
0.0.0-beta.1 | 53 | 11/16/2024 |
0.0.0-beta.0 | 57 | 11/5/2024 |
0.0.0-alpha.11 | 53 | 11/4/2024 |
0.0.0-alpha.10 | 59 | 11/4/2024 |
0.0.0-alpha.9 | 54 | 11/3/2024 |
0.0.0-alpha.8 | 58 | 10/25/2024 |
0.0.0-alpha.7 | 63 | 10/16/2024 |
0.0.0-alpha.6 | 56 | 10/15/2024 |
0.0.0-alpha.5 | 55 | 10/12/2024 |
0.0.0-alpha.4 | 53 | 10/10/2024 |
0.0.0-alpha.3 | 55 | 10/9/2024 |
0.0.0-alpha.2 | 55 | 10/9/2024 |
0.0.0-alpha.1 | 54 | 10/9/2024 |
0.0.0-alpha.0 | 150 | 10/8/2024 |