AsyncHandler.EventSourcing 1.0.5

dotnet add package AsyncHandler.EventSourcing --version 1.0.5                
NuGet\Install-Package AsyncHandler.EventSourcing -Version 1.0.5                
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="AsyncHandler.EventSourcing" Version="1.0.5" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AsyncHandler.EventSourcing --version 1.0.5                
#r "nuget: AsyncHandler.EventSourcing, 1.0.5"                
#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.
// Install AsyncHandler.EventSourcing as a Cake Addin
#addin nuget:?package=AsyncHandler.EventSourcing&version=1.0.5

// Install AsyncHandler.EventSourcing as a Cake Tool
#tool nuget:?package=AsyncHandler.EventSourcing&version=1.0.5                

asynchandler

A lightweight event sourcing framework for .Net with event-store of choice.

Github follow In follow Nuget Package Nuget Github follow build Status

Overview

asynchandler is a high-performance event sourcing framework built for .Net that allows selecting event storage of choice. Combining consistency with schema flexibility, asynchandler aims to make event sourcing simplified for everyone. Currently supports Azure Sql, Postgres and Sql Server.

Prerequisites

asynchandler 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 sqlserver or postgres databases, execute docker-compose.

docker compose --project-name asynchandler up -d

Usage

Simply install AsyncHandler.EventSourcing package.

dotnet add package AsyncHandler.EventSourcing

Use AddAsyncHandler service collection extension.

var connectionString = builder.Configuration["postgresqlsecret"]??
    throw new Exception("No connection defined");

builder.Services.AddAsyncHandler(asynchandler =>
{
    asynchandler.Schema = "ah";
    asynchandler.AddEventSourcing(source =>
    {
        source.SelectEventSource(EventSources.PostgresSql, connectionString);
    });
});

Select your event source of choice from SelectEventSource. Make sure you have defined your connection string.

Define your aggregate

Add your aggregate with AggregateRoot

public class OrderBookingAggregate : AggregateRoot<long> // or Guid
{
    public OrderStatus OrderStatus { get; private set; }
    protected override void Apply(SourcedEvent e)
    {
        this.InvokeApply(e);
    }
    public void Apply(OrderPlaced e)
    {
        OrderStatus = OrderStatus.Placed;
    }
    public void PlaceOrder(PlaceOrder command)
    {
        if(OrderStatus == OrderStatus.Placed)
            return;
        RaiseEvent(new OrderPlaced(command));
    }
}

AggregateRoot allows selecting long or Guid for sourceId, selecting long offers lightnening-fast queries.

To continue please visit our GitHub handle.

Give us a star ⭐

If you are an event sourcer and love OSS, give asynchandler a star. 💜

License

This project is licensed under the terms of the MIT license.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on AsyncHandler.EventSourcing:

Package Downloads
AsyncHandler.Workflows

Github workflows and packages

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.5 104 10/1/2024
1.0.4 111 9/22/2024
1.0.3 118 9/19/2024
1.0.2 137 9/14/2024
1.0.1 121 9/11/2024
1.0.0 168 9/9/2024
1.0.0-alpha.0 240 9/5/2024