Shuttle.Recall
14.0.0
Prefix Reserved
See the version list below for details.
dotnet add package Shuttle.Recall --version 14.0.0
NuGet\Install-Package Shuttle.Recall -Version 14.0.0
<PackageReference Include="Shuttle.Recall" Version="14.0.0" />
paket add Shuttle.Recall --version 14.0.0
#r "nuget: Shuttle.Recall, 14.0.0"
// 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
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 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. |
-
- Shuttle.Core.Compression (>= 10.0.4)
- Shuttle.Core.Container (>= 12.0.1)
- Shuttle.Core.Contract (>= 10.0.3)
- Shuttle.Core.Encryption (>= 10.0.3)
- Shuttle.Core.Pipelines (>= 11.0.0)
- Shuttle.Core.PipelineTransaction (>= 10.0.4)
- Shuttle.Core.Reflection (>= 11.0.3)
- Shuttle.Core.Serialization (>= 10.0.5)
- Shuttle.Core.Specification (>= 10.0.3)
- Shuttle.Core.Streams (>= 10.0.3)
- Shuttle.Core.Threading (>= 11.1.1)
- Shuttle.Core.TimeSpanTypeConverters (>= 10.0.2)
- System.Configuration.ConfigurationManager (>= 6.0.0)
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 | 216 | 8/5/2024 |
17.0.1 | 288 | 5/3/2024 |
17.0.0 | 318 | 4/30/2024 |
16.1.1 | 3,644 | 12/1/2022 |
16.0.0 | 3,885 | 9/4/2022 |
14.0.0 | 2,913 | 5/29/2022 |
13.1.0 | 2,669 | 5/6/2022 |
13.0.1 | 4,269 | 4/9/2022 |
13.0.0 | 2,878 | 3/21/2022 |
12.0.5 | 528 | 1/22/2022 |
12.0.3 | 2,865 | 2/4/2021 |
12.0.2 | 1,065 | 1/17/2021 |
12.0.1 | 1,941 | 11/8/2020 |
11.1.0 | 1,495 | 9/1/2020 |
11.0.0 | 2,093 | 8/21/2019 |
10.2.1 | 3,891 | 5/27/2019 |
10.1.4 | 906 | 9/22/2018 |
10.1.3 | 2,974 | 9/16/2018 |
10.0.3 | 1,508 | 8/7/2018 |
10.0.2 | 1,069 | 7/8/2018 |
10.0.0 | 4,308 | 2/13/2018 |
8.2.2 | 2,990 | 8/6/2017 |
8.2.1 | 3,581 | 7/2/2017 |
8.1.3 | 2,535 | 7/1/2017 |
8.0.1 | 1,042 | 5/15/2017 |
8.0.0 | 2,320 | 3/24/2017 |
4.0.0 | 1,103 | 10/2/2016 |
3.6.2 | 2,309 | 6/4/2016 |
3.6.1 | 1,056 | 6/4/2016 |
3.6.0 | 1,067 | 5/18/2016 |
3.5.2 | 2,680 | 4/23/2016 |
3.5.1 | 2,982 | 3/23/2016 |