Shuttle.Recall 14.0.0 The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved

.NET Standard 2.0
Install-Package Shuttle.Recall -Version 14.0.0
dotnet add package Shuttle.Recall --version 14.0.0
<PackageReference Include="Shuttle.Recall" Version="14.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Shuttle.Recall --version 14.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Shuttle.Recall, 14.0.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Shuttle.Recall as a Cake Addin
#addin nuget:?package=Shuttle.Recall&version=14.0.0

// Install Shuttle.Recall as a Cake Tool
#tool nuget:?package=Shuttle.Recall&version=14.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Shuttle.Recall

A .Net event-sourcing mechanism.

Documentation

If you would like to give Shuttle.Recall a spin you can head over to our documentation site.

Getting Started

This guide demonstrates using Shuttle.Recall with a Sql Server implementation.

Start a new Console Application project called RecallQuickstart and select a Shuttle.Recall implementation:

PM> Install-Package Shuttle.Recall.Sql.Storage

Now we'll need select one of the supported containers:

PM> Install-Package Shuttle.Core.Ninject

Since we will be interacting with Sql Server we will be using the Shuttle.Core.Data data access components as well as the System.Data.Client package:

PM> Install-Package Shuttle.Core.Data
PM> Install-Package System.Data.Client

Now we'll define the domain event that will represent a state change in the Name attribute:

public class Renamed
{
    public string Name { get; set; }
}

Next we'll create our Aggregate Root that will make use of an EventStream to save it's states:

using System;
using System.Collections.Generic;

namespace RecallQuickstart
{
    public class AggregateRoot
    {
        public Guid Id { get; }
        public string Name { get; private set; }

        public List<string> AllNames { get; } = new List<string>();

        public AggregateRoot(Guid id)
        {
            Id = id;
        }

        public Renamed Rename(string name)
        {
            return On(new Renamed
            {
                Name = name
            });
        }

        private Renamed On(Renamed renamed)
        {
            Name = renamed.Name;

            AllNames.Add(Name);

            return renamed;
        }
    }
}

Create a new Sql Server database called RecallQuickstart to store our events and execute the following creation script against that database:

%userprofile%\.nuget\packages\shuttle.recall.sql.storage\{version}\scripts\System.Data.SqlClient\EventStoreCreate.sql

Add the relevant connectionString to the App.config file:

<configuration>
  <connectionStrings>
    <add 
        name="EventStore" 
        providerName="System.Data.SqlClient" 
        connectionString="Data Source=.;Initial Catalog=RecallQuickstart;user id=sa;password=Pass!000" 
    />
  </connectionStrings>
</configuration>

Next we'll use event sourcing to store an rehydrate our aggregate root from the Main() entry point:

using System;
using System.Data.Common;
using System.Data.SqlClient;
using Ninject;
using Shuttle.Core.Data;
using Shuttle.Core.Ninject;
using Shuttle.Recall;
using Shuttle.Recall.Sql.Storage;

namespace RecallQuickstart
{
    internal class Program
    {
        private static void Main()
        {
            DbProviderFactories.RegisterFactory("System.Data.SqlClient", SqlClientFactory.Instance);

            var container = new NinjectComponentContainer(new StandardKernel());

            // This registers the event store dependencies provided by Shuttle.Recall
            container.RegisterEventStore();

            // This registers the sql server implementations provided by Shuttle.Recall.Sql.Storage
            container.RegisterEventStoreStorage();
            
            // This registers the ado.net components provided by Shuttle.Core.Data
            container.RegisterDataAccess();

            var databaseContextFactory = container.Resolve<IDatabaseContextFactory>();
            var store = container.Resolve<IEventStore>();

            var id = Guid.NewGuid();

            // we can very easily also add unit tests for our aggregate in a separate project... done here as an example
            var aggregateRoot1 = new AggregateRoot(id);
            var stream1 = store.CreateEventStream(id);

            stream1.AddEvent(aggregateRoot1.Rename("Name-1"));
            stream1.AddEvent(aggregateRoot1.Rename("Name-2"));
            stream1.AddEvent(aggregateRoot1.Rename("Name-3"));
            stream1.AddEvent(aggregateRoot1.Rename("Name-4"));
            stream1.AddEvent(aggregateRoot1.Rename("Name-5"));

            if (aggregateRoot1.AllNames.Count != 5)
            {
                throw new ApplicationException();
            }

            if (!aggregateRoot1.Name.Equals("Name-5"))
            {
                throw new ApplicationException();
            }

            using (databaseContextFactory.Create("EventStore"))
            {
                store.Save(stream1);
            }

            var aggregateRoot2 = new AggregateRoot(id);

            EventStream stream2;

            using (databaseContextFactory.Create("EventStore"))
            {
                stream2 = store.Get(id);
            }

            stream2.Apply(aggregateRoot2);

            if (aggregateRoot2.AllNames.Count != 5)
            {
                throw new ApplicationException();
            }

            if (!aggregateRoot2.Name.Equals("Name-5"))
            {
                throw new ApplicationException();
            }
        }
    }
}

Once you have executed the program you'll find the 5 relevant entries in the EventStore table in the database.

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (6)

Showing the top 5 NuGet packages that depend on Shuttle.Recall:

Package Downloads
Shuttle.Recall.Sql.Storage The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

Sql-based implementation of the event store Shuttle.Recall persistence interfaces.

Shuttle.Esb.Process The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

Shuttle.Esb process management using Shuttle.Recall event sourcing.

Shuttle.Recall.Sql.EventProcessing The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

Sql-based implementation of the event store Shuttle.Recall projection interfaces.

Shuttle.Recall.Tests The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

Tests to exercise Shuttle.Recall component implementations.

Shuttle.Access.Sql The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

Provides Sql-based implementation of data access components for use with Shuttle.Access implementations.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
14.0.0 169 5/29/2022
13.1.0 146 5/6/2022
13.0.1 246 4/9/2022
13.0.0 153 3/21/2022
12.0.5 102 1/22/2022
12.0.3 1,072 2/4/2021
12.0.2 286 1/17/2021
12.0.1 572 11/8/2020
11.1.0 533 9/1/2020
11.0.0 764 8/21/2019
10.2.1 976 5/27/2019
10.1.4 629 9/22/2018
10.1.3 1,098 9/16/2018
10.0.3 740 8/7/2018
10.0.2 762 7/8/2018
10.0.0 2,322 2/13/2018
8.2.2 1,089 8/6/2017
8.2.1 1,374 7/2/2017
8.1.3 1,066 7/1/2017
8.0.1 761 5/15/2017
8.0.0 952 3/24/2017
4.0.0 804 10/2/2016
3.6.2 985 6/4/2016
3.6.1 768 6/4/2016
3.6.0 792 5/18/2016
3.5.2 1,279 4/23/2016
3.5.1 1,084 3/23/2016