Shuttle.Recall 16.1.1

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Shuttle.Recall --version 16.1.1                
NuGet\Install-Package Shuttle.Recall -Version 16.1.1                
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="Shuttle.Recall" Version="16.1.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Shuttle.Recall --version 16.1.1                
#r "nuget: Shuttle.Recall, 16.1.1"                
#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 Shuttle.Recall as a Cake Addin
#addin nuget:?package=Shuttle.Recall&version=16.1.1

// Install Shuttle.Recall as a Cake Tool
#tool nuget:?package=Shuttle.Recall&version=16.1.1                

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

This provides a SQL-based store for doamin events.

Install the System.Data.SqlClient nuget package.

This will provide a connection to our Sql Server.

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. In a real-world scenario the aggregate in our domain would be something like Customer, Member, Invoice, and so forth. The aggregate will make use of an EventStream to save the changes in the state:

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

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

using System.Data.Common;
using System.Data.SqlClient;
using Microsoft.Extensions.DependencyInjection;
using Shuttle.Core.Data;
using Shuttle.Recall;
using Shuttle.Recall.Sql.Storage;

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

            var services = new ServiceCollection();

            services
                .AddDataAccess(builder =>
                {
                    builder.AddConnectionString("EventStore", "System.Data.SqlClient",
                        "Data Source=.;Initial Catalog=RecallQuickstart;user id=sa;password=Pass!000");

                    builder.Options.DatabaseContextFactory.DefaultConnectionStringName = "EventStore";
                })
                .AddSqlEventStorage()
                .AddEventStore();

            var provider = services.BuildServiceProvider();

            var databaseContextFactory = provider.GetRequiredService<IDatabaseContextFactory>();
            var store = provider.GetRequiredService<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 Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (8)

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

Package Downloads
Shuttle.Recall.Sql.Storage

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

Shuttle.Esb.Process

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

Shuttle.Recall.Tests

Tests to exercise Shuttle.Recall component implementations.

Shuttle.Recall.Sql.EventProcessing

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

Shuttle.Access.Sql

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
18.0.0 256 8/5/2024
17.0.1 325 5/3/2024
17.0.0 353 4/30/2024
16.1.1 3,645 12/1/2022
16.0.0 3,886 9/4/2022
14.0.0 2,935 5/29/2022
13.1.0 2,672 5/6/2022
13.0.1 4,270 4/9/2022
13.0.0 2,881 3/21/2022
12.0.5 529 1/22/2022
12.0.3 2,868 2/4/2021
12.0.2 1,066 1/17/2021
12.0.1 1,959 11/8/2020
11.1.0 1,496 9/1/2020
11.0.0 2,094 8/21/2019
10.2.1 3,894 5/27/2019
10.1.4 911 9/22/2018
10.1.3 2,977 9/16/2018
10.0.3 1,512 8/7/2018
10.0.2 1,072 7/8/2018
10.0.0 4,311 2/13/2018
8.2.2 2,992 8/6/2017
8.2.1 3,583 7/2/2017
8.1.3 2,539 7/1/2017
8.0.1 1,044 5/15/2017
8.0.0 2,322 3/24/2017
4.0.0 1,105 10/2/2016
3.6.2 2,313 6/4/2016
3.6.1 1,060 6/4/2016
3.6.0 1,069 5/18/2016
3.5.2 2,682 4/23/2016
3.5.1 2,984 3/23/2016