diff --git a/Core.Build.props b/Core.Build.props
index 918e2af55..2a6242621 100644
--- a/Core.Build.props
+++ b/Core.Build.props
@@ -6,7 +6,6 @@
latest
-
-
+
diff --git a/Core.ElasticSearch/Core.ElasticSearch.csproj b/Core.ElasticSearch/Core.ElasticSearch.csproj
index 45ed83ee4..39eb1ec7d 100644
--- a/Core.ElasticSearch/Core.ElasticSearch.csproj
+++ b/Core.ElasticSearch/Core.ElasticSearch.csproj
@@ -8,7 +8,7 @@
-
+
diff --git a/Sample/EventStoreDB/DataAnalytics/DataAnalytics.Core/ElasticSearch/ElasticSearchRepository.cs b/Core.ElasticSearch/Repository/ElasticSearchExtensions.cs
similarity index 81%
rename from Sample/EventStoreDB/DataAnalytics/DataAnalytics.Core/ElasticSearch/ElasticSearchRepository.cs
rename to Core.ElasticSearch/Repository/ElasticSearchExtensions.cs
index 5266bcf56..78ece0f03 100644
--- a/Sample/EventStoreDB/DataAnalytics/DataAnalytics.Core/ElasticSearch/ElasticSearchRepository.cs
+++ b/Core.ElasticSearch/Repository/ElasticSearchExtensions.cs
@@ -1,25 +1,21 @@
-using System;
using System.Collections.Concurrent;
-using System.Linq;
-using System.Threading;
-using System.Threading.Tasks;
using Nest;
-namespace DataAnalytics.Core.ElasticSearch
-{
+namespace Core.ElasticSearch.Repository;
+
+
public static class ElasticSearchRepository
{
-
public static async Task Find(this IElasticClient elasticClient, string id, CancellationToken ct)
where T: class =>
- (await elasticClient.GetAsync(id, ct: ct))?.Source;
+ (await elasticClient.GetAsync(id, ct: ct).ConfigureAwait(false))?.Source;
public static async Task Upsert(this IElasticClient elasticClient, string id, T entity, CancellationToken ct)
where T: class =>
await elasticClient.UpdateAsync(id,
u => u.Doc(entity).Upsert(entity).Index(ToIndexName()),
ct
- );
+ ).ConfigureAwait(false);
private static readonly ConcurrentDictionary TypeNameMap = new();
@@ -33,5 +29,3 @@ private static string ToIndexName()
});
}
}
-}
-
diff --git a/Core.EventStoreDB.Tests/Core.EventStoreDB.Tests.csproj b/Core.EventStoreDB.Tests/Core.EventStoreDB.Tests.csproj
index 05de187fc..87e7bec6e 100644
--- a/Core.EventStoreDB.Tests/Core.EventStoreDB.Tests.csproj
+++ b/Core.EventStoreDB.Tests/Core.EventStoreDB.Tests.csproj
@@ -11,20 +11,20 @@
-
-
+
+
-
-
-
+
+
+
all
runtime; build; native; contentfiles; analyzers
-
+
diff --git a/Core.EventStoreDB/Core.EventStoreDB.csproj b/Core.EventStoreDB/Core.EventStoreDB.csproj
index 2ad3db709..ee00c9f57 100644
--- a/Core.EventStoreDB/Core.EventStoreDB.csproj
+++ b/Core.EventStoreDB/Core.EventStoreDB.csproj
@@ -8,9 +8,9 @@
-
+
-
+
diff --git a/Core.EventStoreDB/Events/EventStoreDBExtensions.cs b/Core.EventStoreDB/Events/EventStoreDBExtensions.cs
index d6c8c0182..f293826f2 100644
--- a/Core.EventStoreDB/Events/EventStoreDBExtensions.cs
+++ b/Core.EventStoreDB/Events/EventStoreDBExtensions.cs
@@ -1,12 +1,39 @@
using Core.EventStoreDB.Serialization;
using Core.Exceptions;
using Core.OpenTelemetry;
+using Core.Reflection;
using EventStore.Client;
namespace Core.EventStoreDB.Events;
public static class EventStoreDBExtensions
{
+ public static async Task Find(
+ this EventStoreClient eventStore,
+ Func when,
+ string id,
+ CancellationToken cancellationToken
+ ) where TEntity: class
+ {
+ var readResult = eventStore.ReadStreamAsync(
+ Direction.Forwards,
+ id,
+ StreamPosition.Start,
+ cancellationToken: cancellationToken
+ );
+
+ if (await readResult.ReadState.ConfigureAwait(false) == ReadState.StreamNotFound)
+ return null;
+
+ return await readResult
+ .Select(@event => @event.Deserialize()!)
+ .AggregateAsync(
+ ObjectFactory.GetDefaultOrUninitialized(),
+ when,
+ cancellationToken
+ ).ConfigureAwait(false);
+ }
+
public static async Task Find(
this EventStoreClient eventStore,
Func getDefault,
@@ -88,4 +115,75 @@ CancellationToken cancellationToken
return result.NextExpectedStreamRevision;
}
+
+ public static async Task ReadLastEvent(
+ this EventStoreClient eventStore,
+ string id,
+ CancellationToken ct
+ ) where TEvent : class
+ {
+ var resolvedEvent = await eventStore.ReadLastEvent(id, ct).ConfigureAwait(false);
+
+ return resolvedEvent?.Deserialize();
+ }
+
+ public static async Task ReadLastEvent(
+ this EventStoreClient eventStore,
+ string id,
+ CancellationToken ct
+ )
+ {
+ var result = eventStore.ReadStreamAsync(
+ Direction.Backwards,
+ id,
+ StreamPosition.End,
+ maxCount: 1,
+ cancellationToken: ct
+ );
+
+ if (await result.ReadState.ConfigureAwait(false) == ReadState.StreamNotFound)
+ {
+ return null;
+ }
+
+ return await result.FirstAsync(ct).ConfigureAwait(false);
+ }
+
+ public static async Task AppendToStreamWithSingleEvent(
+ this EventStoreClient eventStore,
+ string id,
+ object @event,
+ CancellationToken ct
+ )
+ {
+ var eventData = new[] { @event.ToJsonEventData() };
+
+ var result = await eventStore.AppendToStreamAsync(
+ id,
+ StreamState.StreamExists,
+ eventData,
+ options =>
+ {
+ options.ThrowOnAppendFailure = false;
+ },
+ cancellationToken: ct
+ ).ConfigureAwait(false);
+
+ if (result is SuccessResult)
+ return;
+
+ await eventStore.SetStreamMetadataAsync(
+ id,
+ StreamState.NoStream,
+ new StreamMetadata(maxCount: 1),
+ cancellationToken: ct
+ ).ConfigureAwait(false);
+
+ await eventStore.AppendToStreamAsync(
+ id,
+ StreamState.NoStream,
+ eventData,
+ cancellationToken: ct
+ ).ConfigureAwait(false);
+ }
}
diff --git a/Core.Kafka.Tests/Core.Kafka.Tests.csproj b/Core.Kafka.Tests/Core.Kafka.Tests.csproj
index b7990c9db..ad0941b33 100644
--- a/Core.Kafka.Tests/Core.Kafka.Tests.csproj
+++ b/Core.Kafka.Tests/Core.Kafka.Tests.csproj
@@ -15,8 +15,8 @@
-
-
+
+
all
@@ -24,6 +24,6 @@
-
+
diff --git a/Core.Kafka/Core.Kafka.csproj b/Core.Kafka/Core.Kafka.csproj
index 8e74d9198..75a44c260 100644
--- a/Core.Kafka/Core.Kafka.csproj
+++ b/Core.Kafka/Core.Kafka.csproj
@@ -5,9 +5,9 @@
-
+
-
+
diff --git a/Core.Marten/Core.Marten.csproj b/Core.Marten/Core.Marten.csproj
index da5e22c71..494b227ca 100644
--- a/Core.Marten/Core.Marten.csproj
+++ b/Core.Marten/Core.Marten.csproj
@@ -6,9 +6,9 @@
-
+
-
+
diff --git a/Core.Testing/Core.Testing.csproj b/Core.Testing/Core.Testing.csproj
index 64502fc92..ef1eeb1ad 100644
--- a/Core.Testing/Core.Testing.csproj
+++ b/Core.Testing/Core.Testing.csproj
@@ -13,9 +13,9 @@
-
-
-
+
+
+
diff --git a/Core.Tests/Core.Tests.csproj b/Core.Tests/Core.Tests.csproj
index 6f863327d..24cb1136d 100644
--- a/Core.Tests/Core.Tests.csproj
+++ b/Core.Tests/Core.Tests.csproj
@@ -11,20 +11,20 @@
-
+
-
-
-
-
+
+
+
+
all
runtime; build; native; contentfiles; analyzers
-
+
diff --git a/Core.WebApi/Core.WebApi.csproj b/Core.WebApi/Core.WebApi.csproj
index 9dc650719..2f6d9d565 100644
--- a/Core.WebApi/Core.WebApi.csproj
+++ b/Core.WebApi/Core.WebApi.csproj
@@ -5,8 +5,8 @@
-
-
+
+
diff --git a/Core/Core.csproj b/Core/Core.csproj
index d64e535e5..9db17e263 100644
--- a/Core/Core.csproj
+++ b/Core/Core.csproj
@@ -9,15 +9,15 @@
-
+
-
-
+
+
diff --git a/Core/Events/Config.cs b/Core/Events/Config.cs
index 017691d3a..1827d39c8 100644
--- a/Core/Events/Config.cs
+++ b/Core/Events/Config.cs
@@ -13,4 +13,22 @@ this IServiceCollection services
.AddTransient()
.AddTransient>(sp => sp.GetRequiredService());
}
+
+ public static IServiceCollection AddEventHandler(
+ this IServiceCollection services,
+ Func handler
+ )
+ {
+ return services
+ .AddTransient>(sp => new EventHandler((e, ct) => handler(sp, e, ct)));
+ }
+
+ public static IServiceCollection AddEventHandler(
+ this IServiceCollection services,
+ Func handler
+ )
+ {
+ return services
+ .AddTransient>(_ => new EventHandler(handler));
+ }
}
diff --git a/Core/Events/IEventHandler.cs b/Core/Events/IEventHandler.cs
index a1e51574d..28891cc93 100644
--- a/Core/Events/IEventHandler.cs
+++ b/Core/Events/IEventHandler.cs
@@ -4,3 +4,14 @@ public interface IEventHandler
{
Task Handle(TEvent @event, CancellationToken ct);
}
+
+public class EventHandler : IEventHandler
+{
+ private readonly Func handler;
+
+ public EventHandler(Func handler) =>
+ this.handler = handler;
+
+ public Task Handle(TEvent @event, CancellationToken ct) =>
+ handler(@event, ct);
+}
diff --git a/Core/Reflection/ObjectFactory.cs b/Core/Reflection/ObjectFactory.cs
new file mode 100644
index 000000000..f29e18fb3
--- /dev/null
+++ b/Core/Reflection/ObjectFactory.cs
@@ -0,0 +1,31 @@
+using System.Linq.Expressions;
+using System.Reflection;
+using System.Runtime.Serialization;
+
+namespace Core.Reflection;
+
+public static class ObjectFactory
+{
+ public static readonly Func GetDefaultOrUninitialized = Creator();
+
+ private static Func Creator()
+ {
+ var t = typeof(T);
+ if (t == typeof(string))
+ return Expression.Lambda>(Expression.Constant(string.Empty)).Compile();
+
+ if (t.HasDefaultConstructor())
+ return Expression.Lambda>(Expression.New(t)).Compile();
+
+ return () => (T)FormatterServices.GetUninitializedObject(t);
+ }
+}
+
+public static class ObjectFactory
+{
+ public static bool HasDefaultConstructor(this Type t)
+ {
+ return t.IsValueType || t.GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic,
+ null, Type.EmptyTypes, null) != null;
+ }
+}
diff --git a/EventSourcing.Integration.Tests/EventSourcing.Integration.Tests.csproj b/EventSourcing.Integration.Tests/EventSourcing.Integration.Tests.csproj
index 7dd84efba..10a9298c7 100644
--- a/EventSourcing.Integration.Tests/EventSourcing.Integration.Tests.csproj
+++ b/EventSourcing.Integration.Tests/EventSourcing.Integration.Tests.csproj
@@ -11,16 +11,16 @@
-
-
-
-
+
+
+
+
all
runtime; build; native; contentfiles; analyzers
-
+
diff --git a/EventSourcing.NetCore.sln b/EventSourcing.NetCore.sln
index 8c3ba553a..00e5ebb40 100644
--- a/EventSourcing.NetCore.sln
+++ b/EventSourcing.NetCore.sln
@@ -404,8 +404,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ECommerce", "Sample\EventSt
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MarketBasketAnalytics", "Sample\EventStoreDB\DataAnalytics\MarketBasketAnalytics\MarketBasketAnalytics.csproj", "{D25B8D85-9598-4323-8B71-66BE2F3F3F31}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataAnalytics.Core", "Sample\EventStoreDB\DataAnalytics\DataAnalytics.Core\DataAnalytics.Core.csproj", "{C53D404F-F27A-4368-92B9-F2C4202B04FB}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MarketBasketAnalytics.Api", "Sample\EventStoreDB\DataAnalytics\MarketBasketAnalytics.Api\MarketBasketAnalytics.Api.csproj", "{DE90D2E2-80F3-4C9A-A5E6-78A2684FEB96}"
EndProject
Global
@@ -902,10 +900,6 @@ Global
{D25B8D85-9598-4323-8B71-66BE2F3F3F31}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D25B8D85-9598-4323-8B71-66BE2F3F3F31}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D25B8D85-9598-4323-8B71-66BE2F3F3F31}.Release|Any CPU.Build.0 = Release|Any CPU
- {C53D404F-F27A-4368-92B9-F2C4202B04FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {C53D404F-F27A-4368-92B9-F2C4202B04FB}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {C53D404F-F27A-4368-92B9-F2C4202B04FB}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {C53D404F-F27A-4368-92B9-F2C4202B04FB}.Release|Any CPU.Build.0 = Release|Any CPU
{DE90D2E2-80F3-4C9A-A5E6-78A2684FEB96}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DE90D2E2-80F3-4C9A-A5E6-78A2684FEB96}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DE90D2E2-80F3-4C9A-A5E6-78A2684FEB96}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -1074,7 +1068,6 @@ Global
{12188348-C513-4A55-A704-6AC0B52815BE} = {9C5C1CB3-B8CD-4CEE-A5F2-5983770C60BB}
{D37BADD9-A7D8-4C24-9976-8BE2F1695E82} = {12188348-C513-4A55-A704-6AC0B52815BE}
{D25B8D85-9598-4323-8B71-66BE2F3F3F31} = {12188348-C513-4A55-A704-6AC0B52815BE}
- {C53D404F-F27A-4368-92B9-F2C4202B04FB} = {12188348-C513-4A55-A704-6AC0B52815BE}
{DE90D2E2-80F3-4C9A-A5E6-78A2684FEB96} = {12188348-C513-4A55-A704-6AC0B52815BE}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
diff --git a/Marten.Integration.Tests/Marten.Integration.Tests.csproj b/Marten.Integration.Tests/Marten.Integration.Tests.csproj
index f666da82d..4ae282af4 100644
--- a/Marten.Integration.Tests/Marten.Integration.Tests.csproj
+++ b/Marten.Integration.Tests/Marten.Integration.Tests.csproj
@@ -11,18 +11,18 @@
-
-
-
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
all
runtime; build; native; contentfiles; analyzers
@@ -30,8 +30,8 @@
-
+
-
+
diff --git a/Sample/AsyncProjections/SmartHome.Api/SmartHome.Api.csproj b/Sample/AsyncProjections/SmartHome.Api/SmartHome.Api.csproj
index 09e5bcf56..21c9434ff 100644
--- a/Sample/AsyncProjections/SmartHome.Api/SmartHome.Api.csproj
+++ b/Sample/AsyncProjections/SmartHome.Api/SmartHome.Api.csproj
@@ -5,8 +5,8 @@
-
-
+
+
diff --git a/Sample/CRUDToCQRS/01-CRUD/ECommerce/ECommerce.csproj b/Sample/CRUDToCQRS/01-CRUD/ECommerce/ECommerce.csproj
index 3c4201ea1..76845dbb1 100644
--- a/Sample/CRUDToCQRS/01-CRUD/ECommerce/ECommerce.csproj
+++ b/Sample/CRUDToCQRS/01-CRUD/ECommerce/ECommerce.csproj
@@ -5,15 +5,15 @@
-
+
-
-
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
+
+
diff --git a/Sample/CRUDToCQRS/02-CRUDWithCQRS/ECommerce/ECommerce.csproj b/Sample/CRUDToCQRS/02-CRUDWithCQRS/ECommerce/ECommerce.csproj
index 3c4201ea1..76845dbb1 100644
--- a/Sample/CRUDToCQRS/02-CRUDWithCQRS/ECommerce/ECommerce.csproj
+++ b/Sample/CRUDToCQRS/02-CRUDWithCQRS/ECommerce/ECommerce.csproj
@@ -5,15 +5,15 @@
-
+
-
-
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
+
+
diff --git a/Sample/CRUDToCQRS/03-DomainGrouping/ECommerce.Domain/ECommerce.Domain.csproj b/Sample/CRUDToCQRS/03-DomainGrouping/ECommerce.Domain/ECommerce.Domain.csproj
index 3839cc500..fd627869d 100644
--- a/Sample/CRUDToCQRS/03-DomainGrouping/ECommerce.Domain/ECommerce.Domain.csproj
+++ b/Sample/CRUDToCQRS/03-DomainGrouping/ECommerce.Domain/ECommerce.Domain.csproj
@@ -5,12 +5,12 @@
-
+
-
-
+
+
-
+
diff --git a/Sample/CRUDToCQRS/03-DomainGrouping/ECommerce/ECommerce.csproj b/Sample/CRUDToCQRS/03-DomainGrouping/ECommerce/ECommerce.csproj
index b34f1c652..9eae8e25c 100644
--- a/Sample/CRUDToCQRS/03-DomainGrouping/ECommerce/ECommerce.csproj
+++ b/Sample/CRUDToCQRS/03-DomainGrouping/ECommerce/ECommerce.csproj
@@ -5,15 +5,15 @@
-
+
-
-
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
+
+
diff --git a/Sample/CRUDToCQRS/04-SlimmedDomain/ECommerce.Domain/ECommerce.Domain.csproj b/Sample/CRUDToCQRS/04-SlimmedDomain/ECommerce.Domain/ECommerce.Domain.csproj
index 3839cc500..fd627869d 100644
--- a/Sample/CRUDToCQRS/04-SlimmedDomain/ECommerce.Domain/ECommerce.Domain.csproj
+++ b/Sample/CRUDToCQRS/04-SlimmedDomain/ECommerce.Domain/ECommerce.Domain.csproj
@@ -5,12 +5,12 @@
-
+
-
-
+
+
-
+
diff --git a/Sample/CRUDToCQRS/04-SlimmedDomain/ECommerce/ECommerce.csproj b/Sample/CRUDToCQRS/04-SlimmedDomain/ECommerce/ECommerce.csproj
index b34f1c652..9eae8e25c 100644
--- a/Sample/CRUDToCQRS/04-SlimmedDomain/ECommerce/ECommerce.csproj
+++ b/Sample/CRUDToCQRS/04-SlimmedDomain/ECommerce/ECommerce.csproj
@@ -5,15 +5,15 @@
-
+
-
-
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
+
+
diff --git a/Sample/CRUDToCQRS/05-ExplicitDomain/ECommerce.Domain/ECommerce.Domain.csproj b/Sample/CRUDToCQRS/05-ExplicitDomain/ECommerce.Domain/ECommerce.Domain.csproj
index b9572ea16..4dc7dd0c3 100644
--- a/Sample/CRUDToCQRS/05-ExplicitDomain/ECommerce.Domain/ECommerce.Domain.csproj
+++ b/Sample/CRUDToCQRS/05-ExplicitDomain/ECommerce.Domain/ECommerce.Domain.csproj
@@ -5,10 +5,10 @@
-
-
+
+
-
+
diff --git a/Sample/CRUDToCQRS/05-ExplicitDomain/ECommerce/ECommerce.csproj b/Sample/CRUDToCQRS/05-ExplicitDomain/ECommerce/ECommerce.csproj
index 8a000f987..8f8b835dd 100644
--- a/Sample/CRUDToCQRS/05-ExplicitDomain/ECommerce/ECommerce.csproj
+++ b/Sample/CRUDToCQRS/05-ExplicitDomain/ECommerce/ECommerce.csproj
@@ -5,13 +5,13 @@
-
-
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
+
+
diff --git a/Sample/CRUDToCQRS/06-SlicedDomain/ECommerce.Domain/ECommerce.Domain.csproj b/Sample/CRUDToCQRS/06-SlicedDomain/ECommerce.Domain/ECommerce.Domain.csproj
index b9572ea16..4dc7dd0c3 100644
--- a/Sample/CRUDToCQRS/06-SlicedDomain/ECommerce.Domain/ECommerce.Domain.csproj
+++ b/Sample/CRUDToCQRS/06-SlicedDomain/ECommerce.Domain/ECommerce.Domain.csproj
@@ -5,10 +5,10 @@
-
-
+
+
-
+
diff --git a/Sample/CRUDToCQRS/06-SlicedDomain/ECommerce/ECommerce.csproj b/Sample/CRUDToCQRS/06-SlicedDomain/ECommerce/ECommerce.csproj
index 8a000f987..8f8b835dd 100644
--- a/Sample/CRUDToCQRS/06-SlicedDomain/ECommerce/ECommerce.csproj
+++ b/Sample/CRUDToCQRS/06-SlicedDomain/ECommerce/ECommerce.csproj
@@ -5,13 +5,13 @@
-
-
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
+
+
diff --git a/Sample/CRUDToCQRS/07-FlattenedLayers/ECommerce.Domain/ECommerce.Domain.csproj b/Sample/CRUDToCQRS/07-FlattenedLayers/ECommerce.Domain/ECommerce.Domain.csproj
index b9572ea16..4dc7dd0c3 100644
--- a/Sample/CRUDToCQRS/07-FlattenedLayers/ECommerce.Domain/ECommerce.Domain.csproj
+++ b/Sample/CRUDToCQRS/07-FlattenedLayers/ECommerce.Domain/ECommerce.Domain.csproj
@@ -5,10 +5,10 @@
-
-
+
+
-
+
diff --git a/Sample/CRUDToCQRS/07-FlattenedLayers/ECommerce/ECommerce.csproj b/Sample/CRUDToCQRS/07-FlattenedLayers/ECommerce/ECommerce.csproj
index 8a000f987..8f8b835dd 100644
--- a/Sample/CRUDToCQRS/07-FlattenedLayers/ECommerce/ECommerce.csproj
+++ b/Sample/CRUDToCQRS/07-FlattenedLayers/ECommerce/ECommerce.csproj
@@ -5,13 +5,13 @@
-
-
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
+
+
diff --git a/Sample/CRUDToCQRS/08-SlicedEndpoints/ECommerce.Domain/ECommerce.Domain.csproj b/Sample/CRUDToCQRS/08-SlicedEndpoints/ECommerce.Domain/ECommerce.Domain.csproj
index 9d1173f76..71c38a7d5 100644
--- a/Sample/CRUDToCQRS/08-SlicedEndpoints/ECommerce.Domain/ECommerce.Domain.csproj
+++ b/Sample/CRUDToCQRS/08-SlicedEndpoints/ECommerce.Domain/ECommerce.Domain.csproj
@@ -9,10 +9,10 @@
-
-
+
+
-
+
diff --git a/Sample/CRUDToCQRS/08-SlicedEndpoints/ECommerce/ECommerce.csproj b/Sample/CRUDToCQRS/08-SlicedEndpoints/ECommerce/ECommerce.csproj
index 8a000f987..8f8b835dd 100644
--- a/Sample/CRUDToCQRS/08-SlicedEndpoints/ECommerce/ECommerce.csproj
+++ b/Sample/CRUDToCQRS/08-SlicedEndpoints/ECommerce/ECommerce.csproj
@@ -5,13 +5,13 @@
-
-
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
+
+
diff --git a/Sample/CRUDToCQRS/09-MultipleModules/ECommerce.Domain/ECommerce.Domain.csproj b/Sample/CRUDToCQRS/09-MultipleModules/ECommerce.Domain/ECommerce.Domain.csproj
index 9d1173f76..71c38a7d5 100644
--- a/Sample/CRUDToCQRS/09-MultipleModules/ECommerce.Domain/ECommerce.Domain.csproj
+++ b/Sample/CRUDToCQRS/09-MultipleModules/ECommerce.Domain/ECommerce.Domain.csproj
@@ -9,10 +9,10 @@
-
-
+
+
-
+
diff --git a/Sample/CRUDToCQRS/09-MultipleModules/ECommerce/ECommerce.csproj b/Sample/CRUDToCQRS/09-MultipleModules/ECommerce/ECommerce.csproj
index 8a000f987..8f8b835dd 100644
--- a/Sample/CRUDToCQRS/09-MultipleModules/ECommerce/ECommerce.csproj
+++ b/Sample/CRUDToCQRS/09-MultipleModules/ECommerce/ECommerce.csproj
@@ -5,13 +5,13 @@
-
-
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
+
+
diff --git a/Sample/ECommerce/Carts/Carts.Api.Tests/Carts.Api.Tests.csproj b/Sample/ECommerce/Carts/Carts.Api.Tests/Carts.Api.Tests.csproj
index 97b7db7c6..5b9d51353 100644
--- a/Sample/ECommerce/Carts/Carts.Api.Tests/Carts.Api.Tests.csproj
+++ b/Sample/ECommerce/Carts/Carts.Api.Tests/Carts.Api.Tests.csproj
@@ -5,14 +5,14 @@
-
+
-
-
+
+
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
@@ -24,6 +24,6 @@
-
+
diff --git a/Sample/ECommerce/Carts/Carts.Api/Carts.Api.csproj b/Sample/ECommerce/Carts/Carts.Api/Carts.Api.csproj
index d552039a7..9d7f38e0c 100644
--- a/Sample/ECommerce/Carts/Carts.Api/Carts.Api.csproj
+++ b/Sample/ECommerce/Carts/Carts.Api/Carts.Api.csproj
@@ -5,14 +5,14 @@
-
-
-
-
+
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
diff --git a/Sample/ECommerce/Carts/Carts.Tests/Carts.Tests.csproj b/Sample/ECommerce/Carts/Carts.Tests/Carts.Tests.csproj
index e35ea217f..817c8d889 100644
--- a/Sample/ECommerce/Carts/Carts.Tests/Carts.Tests.csproj
+++ b/Sample/ECommerce/Carts/Carts.Tests/Carts.Tests.csproj
@@ -5,15 +5,15 @@
-
-
-
+
+
+
all
runtime; build; native; contentfiles; analyzers
-
+
diff --git a/Sample/ECommerce/Orders/Orders.Api.Tests/Orders.Api.Tests.csproj b/Sample/ECommerce/Orders/Orders.Api.Tests/Orders.Api.Tests.csproj
index 1dcafe85e..e47ec76a0 100644
--- a/Sample/ECommerce/Orders/Orders.Api.Tests/Orders.Api.Tests.csproj
+++ b/Sample/ECommerce/Orders/Orders.Api.Tests/Orders.Api.Tests.csproj
@@ -5,14 +5,14 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
@@ -20,10 +20,10 @@
-
-
+
+
-
+
diff --git a/Sample/ECommerce/Orders/Orders.Api/Orders.Api.csproj b/Sample/ECommerce/Orders/Orders.Api/Orders.Api.csproj
index 211c173e7..ab72b206b 100644
--- a/Sample/ECommerce/Orders/Orders.Api/Orders.Api.csproj
+++ b/Sample/ECommerce/Orders/Orders.Api/Orders.Api.csproj
@@ -5,15 +5,15 @@
-
+
-
-
-
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
diff --git a/Sample/ECommerce/Orders/Orders.Tests/Orders.Tests.csproj b/Sample/ECommerce/Orders/Orders.Tests/Orders.Tests.csproj
index f0f8998c3..71272ea9b 100644
--- a/Sample/ECommerce/Orders/Orders.Tests/Orders.Tests.csproj
+++ b/Sample/ECommerce/Orders/Orders.Tests/Orders.Tests.csproj
@@ -6,15 +6,15 @@
-
-
-
+
+
+
all
runtime; build; native; contentfiles; analyzers
-
+
@@ -22,6 +22,6 @@
-
+
diff --git a/Sample/ECommerce/Payments/Payments.Api.Tests/Payments.Api.Tests.csproj b/Sample/ECommerce/Payments/Payments.Api.Tests/Payments.Api.Tests.csproj
index 9acc50e05..683935072 100644
--- a/Sample/ECommerce/Payments/Payments.Api.Tests/Payments.Api.Tests.csproj
+++ b/Sample/ECommerce/Payments/Payments.Api.Tests/Payments.Api.Tests.csproj
@@ -5,14 +5,14 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
@@ -20,10 +20,10 @@
-
-
+
+
-
+
diff --git a/Sample/ECommerce/Payments/Payments.Api/Payments.Api.csproj b/Sample/ECommerce/Payments/Payments.Api/Payments.Api.csproj
index 58f8dc4b4..2f44b8193 100644
--- a/Sample/ECommerce/Payments/Payments.Api/Payments.Api.csproj
+++ b/Sample/ECommerce/Payments/Payments.Api/Payments.Api.csproj
@@ -5,15 +5,15 @@
-
+
-
-
-
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
diff --git a/Sample/ECommerce/Payments/Payments.Tests/Payments.Tests.csproj b/Sample/ECommerce/Payments/Payments.Tests/Payments.Tests.csproj
index 02afacb1d..2436139aa 100644
--- a/Sample/ECommerce/Payments/Payments.Tests/Payments.Tests.csproj
+++ b/Sample/ECommerce/Payments/Payments.Tests/Payments.Tests.csproj
@@ -6,22 +6,22 @@
-
-
-
-
+
+
+
+
all
runtime; build; native; contentfiles; analyzers
-
+
-
+
-
+
diff --git a/Sample/ECommerce/Shipments/Shipments.Api.Tests/Shipments.Api.Tests.csproj b/Sample/ECommerce/Shipments/Shipments.Api.Tests/Shipments.Api.Tests.csproj
index 7c40fe6ef..283f97c77 100644
--- a/Sample/ECommerce/Shipments/Shipments.Api.Tests/Shipments.Api.Tests.csproj
+++ b/Sample/ECommerce/Shipments/Shipments.Api.Tests/Shipments.Api.Tests.csproj
@@ -5,14 +5,14 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
@@ -20,10 +20,10 @@
-
-
+
+
-
+
diff --git a/Sample/ECommerce/Shipments/Shipments.Api/Shipments.Api.csproj b/Sample/ECommerce/Shipments/Shipments.Api/Shipments.Api.csproj
index eae44a510..c52c2cab3 100644
--- a/Sample/ECommerce/Shipments/Shipments.Api/Shipments.Api.csproj
+++ b/Sample/ECommerce/Shipments/Shipments.Api/Shipments.Api.csproj
@@ -5,15 +5,15 @@
-
+
-
-
-
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
diff --git a/Sample/ECommerce/Shipments/Shipments.Tests/Shipments.Tests.csproj b/Sample/ECommerce/Shipments/Shipments.Tests/Shipments.Tests.csproj
index 8bb0ee23f..6624fb935 100644
--- a/Sample/ECommerce/Shipments/Shipments.Tests/Shipments.Tests.csproj
+++ b/Sample/ECommerce/Shipments/Shipments.Tests/Shipments.Tests.csproj
@@ -6,22 +6,22 @@
-
-
-
-
+
+
+
+
all
runtime; build; native; contentfiles; analyzers
-
+
-
+
-
+
diff --git a/Sample/ECommerce/Shipments/Shipments/Shipments.csproj b/Sample/ECommerce/Shipments/Shipments/Shipments.csproj
index c4a422946..ebb4a07ee 100644
--- a/Sample/ECommerce/Shipments/Shipments/Shipments.csproj
+++ b/Sample/ECommerce/Shipments/Shipments/Shipments.csproj
@@ -14,16 +14,16 @@
-
-
+
+
all
runtime; build; native; contentfiles; analyzers
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
diff --git a/Sample/EventPipelines/EventPipelines.MediatR/EventPipelines.MediatR.csproj b/Sample/EventPipelines/EventPipelines.MediatR/EventPipelines.MediatR.csproj
index c7d318d02..66c16e45b 100644
--- a/Sample/EventPipelines/EventPipelines.MediatR/EventPipelines.MediatR.csproj
+++ b/Sample/EventPipelines/EventPipelines.MediatR/EventPipelines.MediatR.csproj
@@ -6,7 +6,7 @@
-
+
diff --git a/Sample/EventPipelines/EventPipelines.Tests/ClassesWithMediatRTest.cs b/Sample/EventPipelines/EventPipelines.Tests/ClassesWithMediatRTest.cs
index 9e3a6feb1..e3367b8fc 100644
--- a/Sample/EventPipelines/EventPipelines.Tests/ClassesWithMediatRTest.cs
+++ b/Sample/EventPipelines/EventPipelines.Tests/ClassesWithMediatRTest.cs
@@ -97,7 +97,6 @@ public ClassesWithMediatRTest()
.AddEventBus()
.RouteEventsFromMediatR()
.AddScoped()
- .AddTransient(s => t => s.GetService(t)!)
.AddEventHandler()
.AddEventHandler()
.AddEventHandler()
diff --git a/Sample/EventPipelines/EventPipelines.Tests/EventPipelines.Tests.csproj b/Sample/EventPipelines/EventPipelines.Tests/EventPipelines.Tests.csproj
index 7cf57896a..2229d9aba 100644
--- a/Sample/EventPipelines/EventPipelines.Tests/EventPipelines.Tests.csproj
+++ b/Sample/EventPipelines/EventPipelines.Tests/EventPipelines.Tests.csproj
@@ -5,8 +5,8 @@
-
-
+
+
all
diff --git a/Sample/EventPipelines/EventPipelines.Tests/PureFunctionsWithMediatRTest.cs b/Sample/EventPipelines/EventPipelines.Tests/PureFunctionsWithMediatRTest.cs
index 0526b6d13..0cdbb1914 100644
--- a/Sample/EventPipelines/EventPipelines.Tests/PureFunctionsWithMediatRTest.cs
+++ b/Sample/EventPipelines/EventPipelines.Tests/PureFunctionsWithMediatRTest.cs
@@ -61,7 +61,6 @@ public PureFunctionsWithMediatRTest()
.AddEventBus()
.RouteEventsFromMediatR()
.AddScoped()
- .AddTransient(s => t => s.GetService(t)!)
.Filter(AdminPipeline.IsAdmin)
.Transform(AdminPipeline.ToAdminAdded)
.Handle(AdminPipeline.Handle)
@@ -86,4 +85,4 @@ public async Task ShouldWork()
AdminPipeline.GlobalAdmins.Single().FirstName.Should().Be("Big");
AdminPipeline.GlobalAdmins.Single().LastName.Should().Be("Bird");
}
-}
\ No newline at end of file
+}
diff --git a/Sample/EventStoreDB/DataAnalytics/DataAnalytics.Core/BackgroundWorkers/BackgroundWorker.cs b/Sample/EventStoreDB/DataAnalytics/DataAnalytics.Core/BackgroundWorkers/BackgroundWorker.cs
deleted file mode 100644
index 0f6010d96..000000000
--- a/Sample/EventStoreDB/DataAnalytics/DataAnalytics.Core/BackgroundWorkers/BackgroundWorker.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-using System;
-using System.Threading;
-using System.Threading.Tasks;
-using Microsoft.Extensions.Hosting;
-using Microsoft.Extensions.Logging;
-
-namespace DataAnalytics.Core.BackgroundWorkers
-{
- public class BackgroundWorker: IHostedService
- {
- private Task? executingTask;
- private CancellationTokenSource? cts;
- private readonly ILogger logger;
- private readonly Func perform;
-
- public BackgroundWorker(
- ILogger logger,
- Func perform
- )
- {
- this.logger = logger;
- this.perform = perform;
- }
-
- public Task StartAsync(CancellationToken cancellationToken)
- {
- // Create a linked token so we can trigger cancellation outside of this token's cancellation
- cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
-
- executingTask = perform(cts.Token);
-
- return executingTask;
- }
-
- public async Task StopAsync(CancellationToken cancellationToken)
- {
- // Stop called without start
- if (executingTask == null)
- return;
-
- // Signal cancellation to the executing method
- cts?.Cancel();
-
- // Wait until the issue completes or the stop token triggers
- await Task.WhenAny(executingTask, Task.Delay(-1, cancellationToken));
-
- // Throw if cancellation triggered
- cancellationToken.ThrowIfCancellationRequested();
-
- logger.LogInformation("Background worker stopped");
- }
- }
-}
diff --git a/Sample/EventStoreDB/DataAnalytics/DataAnalytics.Core/Configuration.cs b/Sample/EventStoreDB/DataAnalytics/DataAnalytics.Core/Configuration.cs
deleted file mode 100644
index b192923c4..000000000
--- a/Sample/EventStoreDB/DataAnalytics/DataAnalytics.Core/Configuration.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using DataAnalytics.Core.ElasticSearch;
-using DataAnalytics.Core.Events;
-using DataAnalytics.Core.EventStoreDB;
-using Microsoft.Extensions.Configuration;
-using Microsoft.Extensions.DependencyInjection;
-
-namespace DataAnalytics.Core
-{
- public static class Configuration
- {
- public static IServiceCollection AddCoreServices(
- this IServiceCollection services,
- IConfiguration configuration
- ) =>
- services
- .AddEventBus()
- .AddEventStoreDB(configuration)
- .AddElasticsearch(configuration);
- }
-}
diff --git a/Sample/EventStoreDB/DataAnalytics/DataAnalytics.Core/DataAnalytics.Core.csproj b/Sample/EventStoreDB/DataAnalytics/DataAnalytics.Core/DataAnalytics.Core.csproj
deleted file mode 100644
index 5390cee05..000000000
--- a/Sample/EventStoreDB/DataAnalytics/DataAnalytics.Core/DataAnalytics.Core.csproj
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
- net6.0
- enable
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Sample/EventStoreDB/DataAnalytics/DataAnalytics.Core/ElasticSearch/Configuration.cs b/Sample/EventStoreDB/DataAnalytics/DataAnalytics.Core/ElasticSearch/Configuration.cs
deleted file mode 100644
index 9b444dac2..000000000
--- a/Sample/EventStoreDB/DataAnalytics/DataAnalytics.Core/ElasticSearch/Configuration.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-using System;
-using Microsoft.Extensions.Configuration;
-using Microsoft.Extensions.DependencyInjection;
-using Nest;
-
-namespace DataAnalytics.Core.ElasticSearch
-{
- public class ElasticSearchConfig
- {
- public string Url { get; set; } = default!;
- public string DefaultIndex { get; set; } = default!;
- }
-
- public static class ElasticSearchConfigExtensions
- {
- private const string DefaultConfigKey = "ElasticSearch";
- public static IServiceCollection AddElasticsearch(
- this IServiceCollection services, IConfiguration configuration, Action? config = null)
- {
- var elasticSearchConfig = configuration.GetSection(DefaultConfigKey).Get();
-
- var settings = new ConnectionSettings(new Uri(elasticSearchConfig.Url))
- .DefaultIndex(elasticSearchConfig.DefaultIndex);
-
- config?.Invoke(settings);
-
- var client = new ElasticClient(settings);
-
- return services.AddSingleton(client);
- }
- }
-}
diff --git a/Sample/EventStoreDB/DataAnalytics/DataAnalytics.Core/EventStoreDB/Configuration.cs b/Sample/EventStoreDB/DataAnalytics/DataAnalytics.Core/EventStoreDB/Configuration.cs
deleted file mode 100644
index f5516295b..000000000
--- a/Sample/EventStoreDB/DataAnalytics/DataAnalytics.Core/EventStoreDB/Configuration.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-using DataAnalytics.Core.Subscriptions;
-using EventStore.Client;
-using Microsoft.Extensions.Configuration;
-using Microsoft.Extensions.DependencyInjection;
-
-namespace DataAnalytics.Core.EventStoreDB
-{
- public class EventStoreDBConfig
- {
- public string ConnectionString { get; set; } = default!;
- }
-
- public record EventStoreDBOptions(
- bool UseInternalCheckpointing = true
- );
-
- public static class EventStoreDBConfigExtensions
- {
- private const string DefaultConfigKey = "EventStore";
-
- public static IServiceCollection AddEventStoreDB(this IServiceCollection services, IConfiguration config, EventStoreDBOptions? options = null)
- {
- var eventStoreDBConfig = config.GetSection(DefaultConfigKey).Get();
-
- services.AddSingleton(
- new EventStoreClient(EventStoreClientSettings.Create(eventStoreDBConfig.ConnectionString)))
- .AddTransient();
-
- if (options?.UseInternalCheckpointing != false)
- {
- services
- .AddTransient();
- }
-
- return services;
- }
- }
-}
diff --git a/Sample/EventStoreDB/DataAnalytics/DataAnalytics.Core/EventStoreDB/EventStoreDBRepository.cs b/Sample/EventStoreDB/DataAnalytics/DataAnalytics.Core/EventStoreDB/EventStoreDBRepository.cs
deleted file mode 100644
index c9735814e..000000000
--- a/Sample/EventStoreDB/DataAnalytics/DataAnalytics.Core/EventStoreDB/EventStoreDBRepository.cs
+++ /dev/null
@@ -1,155 +0,0 @@
-using System;
-using System.Linq;
-using System.Threading;
-using System.Threading.Tasks;
-using DataAnalytics.Core.Serialisation;
-using EventStore.Client;
-
-namespace DataAnalytics.Core.Entities
-{
- public static class EventStoreDBRepository
- {
- public static async Task AggregateStream(
- this EventStoreClient eventStore,
- Func when,
- string id,
- CancellationToken cancellationToken
- ) where TEntity: class
- {
- var result = eventStore.ReadStreamAsync(
- Direction.Forwards,
- id,
- StreamPosition.Start,
- cancellationToken: cancellationToken
- );
-
- if (await result.ReadState == ReadState.StreamNotFound) {
- return null;
- }
-
-
- return (await result
- .Select(@event => @event.DeserializeData())
- .AggregateAsync(
- default,
- when,
- cancellationToken
- ))!;
- }
-
- public static async Task ReadLastEvent(
- this EventStoreClient eventStore,
- string id,
- CancellationToken ct
- ) where TEvent: class
- {
- var resolvedEvent = await eventStore.ReadLastEvent(id, ct);
-
- return resolvedEvent?.DeserializeData();
- }
-
- public static async Task ReadLastEvent(
- this EventStoreClient eventStore,
- string id,
- CancellationToken ct
- )
- {
- var result = eventStore.ReadStreamAsync(
- Direction.Backwards,
- id,
- StreamPosition.End,
- maxCount: 1,
- cancellationToken: ct
- );
-
- if (await result.ReadState == ReadState.StreamNotFound) {
- return null;
- }
-
- return await result.FirstAsync(ct);
- }
-
- public static async Task AppendToNewStream(
- this EventStoreClient eventStore,
- string id,
- object @event,
- CancellationToken cancellationToken
- )
- {
- await eventStore.AppendToStreamAsync(
- id,
- StreamState.NoStream,
- new[] { @event.ToJsonEventData() },
- cancellationToken: cancellationToken
- );
- }
-
- public static async Task AppendToStreamWithSingleEvent(
- this EventStoreClient eventStore,
- string id,
- object @event,
- CancellationToken ct
- )
- {
- var eventData = new[] { @event.ToJsonEventData() };
-
- var result = await eventStore.AppendToStreamAsync(
- id,
- StreamState.StreamExists,
- eventData,
- options => {
- options.ThrowOnAppendFailure = false;
- },
- cancellationToken: ct
- );
-
- if (result is SuccessResult)
- return;
-
- await eventStore.SetStreamMetadataAsync(
- id,
- StreamState.NoStream,
- new StreamMetadata(maxCount:1),
- cancellationToken: ct
- );
-
- await eventStore.AppendToStreamAsync(
- id,
- StreamState.NoStream,
- eventData,
- cancellationToken: ct
- );
- }
-
- public static async Task AppendToExisting(
- this EventStoreClient eventStore,
- string id,
- object @event,
- uint version,
- CancellationToken cancellationToken
- )
- {
- await eventStore.AppendToStreamAsync(
- id,
- StreamRevision.FromInt64(version),
- new[] { @event.ToJsonEventData() },
- cancellationToken: cancellationToken
- );
- }
-
- public static async Task Append(
- this EventStoreClient eventStore,
- string id,
- object @event,
- CancellationToken cancellationToken
- )
- {
- await eventStore.AppendToStreamAsync(
- id,
- StreamState.Any,
- new[] { @event.ToJsonEventData() },
- cancellationToken: cancellationToken
- );
- }
- }
-}
diff --git a/Sample/EventStoreDB/DataAnalytics/DataAnalytics.Core/Events/EventBus.cs b/Sample/EventStoreDB/DataAnalytics/DataAnalytics.Core/Events/EventBus.cs
deleted file mode 100644
index 27c5cc390..000000000
--- a/Sample/EventStoreDB/DataAnalytics/DataAnalytics.Core/Events/EventBus.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-using System;
-using System.Threading;
-using System.Threading.Tasks;
-using EventStore.Client;
-using Microsoft.Extensions.DependencyInjection;
-using Polly;
-using Polly.Retry;
-
-namespace DataAnalytics.Core.Events
-{
- public interface IEventBus
- {
- Task Publish(ResolvedEvent @event, CancellationToken ct);
- }
-
- public class EventBus: IEventBus
- {
- private readonly IServiceProvider serviceProvider;
- private readonly AsyncRetryPolicy retryPolicy;
-
- public EventBus(
- IServiceProvider serviceProvider,
- AsyncRetryPolicy retryPolicy
- )
- {
- this.serviceProvider = serviceProvider;
- this.retryPolicy = retryPolicy;
- }
-
- public async Task Publish(ResolvedEvent @event, CancellationToken ct)
- {
- using var scope = serviceProvider.CreateScope();
-
- var eventHandlers = scope.ServiceProvider
- .GetServices>();
-
- foreach (var handle in eventHandlers)
- {
- await retryPolicy.ExecuteAsync(async token =>
- {
- await handle(scope.ServiceProvider, @event, token);
- }, ct);
- }
- }
- }
-
- public static class EventBusExtensions
- {
- public static IServiceCollection AddEventBus(this IServiceCollection services) =>
- services.AddSingleton(sp =>
- new EventBus(
- sp,
- Policy.Handle().RetryAsync(3)
- )
- );
- }
-}
diff --git a/Sample/EventStoreDB/DataAnalytics/DataAnalytics.Core/Events/EventHandler.cs b/Sample/EventStoreDB/DataAnalytics/DataAnalytics.Core/Events/EventHandler.cs
deleted file mode 100644
index 56242fa31..000000000
--- a/Sample/EventStoreDB/DataAnalytics/DataAnalytics.Core/Events/EventHandler.cs
+++ /dev/null
@@ -1,98 +0,0 @@
-using System;
-using System.Threading;
-using System.Threading.Tasks;
-using DataAnalytics.Core.Serialisation;
-using EventStore.Client;
-using Microsoft.Extensions.DependencyInjection;
-
-namespace DataAnalytics.Core.Events
-{
- public static class EventHandler
- {
- public static IServiceCollection AddEventHandler(
- this IServiceCollection services,
- Func handler,
- string? eventType = null
- ) =>
- services.AddEventHandler(
- (_, resolvedEvent, ct) => handler(resolvedEvent, ct), eventType);
-
- public static IServiceCollection AddEventHandler(
- this IServiceCollection services,
- Func handler,
- string? eventType = null
- )
- {
- services.AddScoped>(
- _ => (sp, resolvedEvent, ct) =>
- {
- if (eventType != null && resolvedEvent.Event.EventType != eventType)
- return Task.CompletedTask;
-
- return handler(sp, resolvedEvent, ct);
- }
- );
-
- return services;
- }
-
- public static IServiceCollection AddEventHandler(
- this IServiceCollection services,
- Func handler
- ) =>
- services.AddEventHandler(
- (_, @event, ct) => handler(@event, ct));
-
- public static IServiceCollection AddEventHandler(
- this IServiceCollection services,
- Func handler
- )
- {
- var eventType = EventTypeMapper.ToName();
-
- services.AddScoped>(
- _ => (sp, resolvedEvent, ct) =>
- {
- if (resolvedEvent.Event.EventType != eventType)
- return Task.CompletedTask;
-
- var @event = resolvedEvent.DeserializeData();
-
- return handler(sp, @event, ct);
- }
- );
-
- return services;
- }
-
- public static IServiceCollection AddEventHandler(
- this IServiceCollection services,
- Func handler
- ) =>
- services.AddEventHandler(
- (_, @event, metadata, ct) => handler(@event, metadata, ct));
-
- public static IServiceCollection AddEventHandler(
- this IServiceCollection services,
- Func handler
- )
- {
- var eventType = EventTypeMapper.ToName();
-
- services.AddScoped>(
- _ => (sp, resolvedEvent, ct) =>
- {
- if (resolvedEvent.Event.EventType != eventType)
- return Task.CompletedTask;
-
- var @event = resolvedEvent.DeserializeData();
- var metadata = resolvedEvent.DeserializeMetadata();
-
- return handler(sp, @event, metadata, ct);
- }
- );
-
- return services;
- }
- }
-}
diff --git a/Sample/EventStoreDB/DataAnalytics/DataAnalytics.Core/Events/EventTypeMapper.cs b/Sample/EventStoreDB/DataAnalytics/DataAnalytics.Core/Events/EventTypeMapper.cs
deleted file mode 100644
index 7691209e8..000000000
--- a/Sample/EventStoreDB/DataAnalytics/DataAnalytics.Core/Events/EventTypeMapper.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-using System;
-using System.Collections.Concurrent;
-using System.Linq;
-
-namespace DataAnalytics.Core.Events
-{
- public class EventTypeMapper
- {
- private static readonly EventTypeMapper Instance = new();
-
- private readonly ConcurrentDictionary TypeNameMap = new();
- private readonly ConcurrentDictionary TypeMap = new();
-
- public static string ToName() => ToName(typeof(TEventType));
-
- public static string ToName(Type eventType) => Instance.TypeNameMap.GetOrAdd(eventType, (_) =>
- {
- var eventTypeName = eventType.FullName!.Replace(".", "_");
-
- Instance.TypeMap.AddOrUpdate(eventTypeName, eventType, (_, _) => eventType);
-
- return eventTypeName;
- });
-
- public static Type ToType(string eventTypeName) => Instance.TypeMap.GetOrAdd(eventTypeName, (_) =>
- {
- var type = GetFirstMatchingTypeFromCurrentDomainAssembly(eventTypeName.Replace("_", "."))!;
-
- if (type == null)
- throw new Exception($"Type for '{eventTypeName}' wasn't found!");
-
- Instance.TypeNameMap.AddOrUpdate(type, eventTypeName, (_, _) => eventTypeName);
-
- return type;
- });
-
- private static Type? GetFirstMatchingTypeFromCurrentDomainAssembly(string typeName)
- {
- return AppDomain.CurrentDomain.GetAssemblies()
- .SelectMany(a => a.GetTypes().Where(x => x.FullName == typeName || x.Name == typeName))
- .FirstOrDefault();
- }
- }
-}
diff --git a/Sample/EventStoreDB/DataAnalytics/DataAnalytics.Core/Serialisation/EventStoreDBSerializer.cs b/Sample/EventStoreDB/DataAnalytics/DataAnalytics.Core/Serialisation/EventStoreDBSerializer.cs
deleted file mode 100644
index 323dd25ef..000000000
--- a/Sample/EventStoreDB/DataAnalytics/DataAnalytics.Core/Serialisation/EventStoreDBSerializer.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-using System;
-using System.Text;
-using System.Text.Json;
-using DataAnalytics.Core.Events;
-using EventStore.Client;
-
-namespace DataAnalytics.Core.Serialisation
-{
- public static class EventStoreDBSerializer
- {
- public static T DeserializeData(this ResolvedEvent resolvedEvent) =>
- (T)DeserializeData(resolvedEvent);
-
- public static object DeserializeData(this ResolvedEvent resolvedEvent) =>
- DeserializeData(resolvedEvent, EventTypeMapper.ToType(resolvedEvent.Event.EventType));
-
- public static object DeserializeData(this ResolvedEvent resolvedEvent, Type eventType)
- {
- // deserialize event
- return JsonSerializer.Deserialize(
- resolvedEvent.Event.Data.Span,
- eventType
- )!;
- }
-
- public static T DeserializeMetadata(this ResolvedEvent resolvedEvent) =>
- (T)DeserializeMetadata(resolvedEvent, typeof(T));
-
- public static object DeserializeMetadata(this ResolvedEvent resolvedEvent, Type metadataType)
- {
- // deserialize event
- return JsonSerializer.Deserialize(
- resolvedEvent.Event.Metadata.Span,
- metadataType
- )!;
- }
-
- public static EventData ToJsonEventData(this object @event) =>
- new(
- Uuid.NewUuid(),
- EventTypeMapper.ToName(@event.GetType()),
- Encoding.UTF8.GetBytes(JsonSerializer.Serialize(@event)),
- Encoding.UTF8.GetBytes(JsonSerializer.Serialize(new { }))
- );
- }
-}
diff --git a/Sample/EventStoreDB/DataAnalytics/DataAnalytics.Core/Subscriptions/EventStoreDBSubscriptionCheckpointRepository.cs b/Sample/EventStoreDB/DataAnalytics/DataAnalytics.Core/Subscriptions/EventStoreDBSubscriptionCheckpointRepository.cs
deleted file mode 100644
index 157674f0f..000000000
--- a/Sample/EventStoreDB/DataAnalytics/DataAnalytics.Core/Subscriptions/EventStoreDBSubscriptionCheckpointRepository.cs
+++ /dev/null
@@ -1,83 +0,0 @@
-using System;
-using System.Linq;
-using System.Threading;
-using System.Threading.Tasks;
-using DataAnalytics.Core.Serialisation;
-using EventStore.Client;
-
-namespace DataAnalytics.Core.Subscriptions
-{
- public record CheckpointStored(
- string SubscriptionId,
- ulong? Position,
- DateTime CheckpointedAt
- );
-
- public class EventStoreDBSubscriptionCheckpointRepository: ISubscriptionCheckpointRepository
- {
- private readonly EventStoreClient eventStoreClient;
-
- public EventStoreDBSubscriptionCheckpointRepository(
- EventStoreClient eventStoreClient)
- {
- this.eventStoreClient = eventStoreClient ?? throw new ArgumentNullException(nameof(eventStoreClient));
- }
-
- public async ValueTask Load(string subscriptionId, CancellationToken ct)
- {
- var streamName = GetCheckpointStreamName(subscriptionId);
-
- var result = eventStoreClient.ReadStreamAsync(Direction.Backwards, streamName, StreamPosition.End, 1,
- cancellationToken: ct);
-
- if (await result.ReadState == ReadState.StreamNotFound)
- {
- return null;
- }
-
- ResolvedEvent? @event = await result.FirstOrDefaultAsync(ct);
-
- return @event?.DeserializeData().Position;
- }
-
- public async ValueTask Store(string subscriptionId, ulong position, CancellationToken ct)
- {
- var @event = new CheckpointStored(subscriptionId, position, DateTime.UtcNow);
- var eventToAppend = new[] {@event.ToJsonEventData()};
- var streamName = GetCheckpointStreamName(subscriptionId);
-
- try
- {
- // store new checkpoint expecting stream to exist
- await eventStoreClient.AppendToStreamAsync(
- streamName,
- StreamState.StreamExists,
- eventToAppend,
- cancellationToken: ct
- );
- }
- catch (WrongExpectedVersionException)
- {
- // WrongExpectedVersionException means that stream did not exist
- // Set the checkpoint stream to have at most 1 event
- // using stream metadata $maxCount property
- await eventStoreClient.SetStreamMetadataAsync(
- streamName,
- StreamState.NoStream,
- new StreamMetadata(1),
- cancellationToken: ct
- );
-
- // append event again expecting stream to not exist
- await eventStoreClient.AppendToStreamAsync(
- streamName,
- StreamState.NoStream,
- eventToAppend,
- cancellationToken: ct
- );
- }
- }
-
- private static string GetCheckpointStreamName(string subscriptionId) => $"checkpoint_{subscriptionId}";
- }
-}
diff --git a/Sample/EventStoreDB/DataAnalytics/DataAnalytics.Core/Subscriptions/EventStoreDBSubscriptionToAll.cs b/Sample/EventStoreDB/DataAnalytics/DataAnalytics.Core/Subscriptions/EventStoreDBSubscriptionToAll.cs
deleted file mode 100644
index 49bdcf40e..000000000
--- a/Sample/EventStoreDB/DataAnalytics/DataAnalytics.Core/Subscriptions/EventStoreDBSubscriptionToAll.cs
+++ /dev/null
@@ -1,203 +0,0 @@
-using System;
-using System.Threading;
-using System.Threading.Tasks;
-using DataAnalytics.Core.BackgroundWorkers;
-using DataAnalytics.Core.Events;
-using DataAnalytics.Core.Threading;
-using EventStore.Client;
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.Logging;
-
-namespace DataAnalytics.Core.Subscriptions
-{
- public class EventStoreDBSubscriptionToAllOptions
- {
- public string SubscriptionId { get; set; } = "default";
-
- public SubscriptionFilterOptions FilterOptions { get; set; } =
- new(EventTypeFilter.ExcludeSystemEvents());
-
- public Action? ConfigureOperation { get; set; }
- public UserCredentials? Credentials { get; set; }
-
- public bool ResolveLinkTos { get; set; }
- }
-
- public class EventStoreDBSubscriptionToAll
- {
- private readonly EventStoreClient eventStoreClient;
- private readonly IEventBus eventBus;
- private readonly ISubscriptionCheckpointRepository checkpointRepository;
- private readonly ILogger logger;
- private EventStoreDBSubscriptionToAllOptions subscriptionOptions = default!;
- private string SubscriptionId => subscriptionOptions.SubscriptionId;
- private readonly object resubscribeLock = new();
- private CancellationToken cancellationToken;
-
- public EventStoreDBSubscriptionToAll(
- EventStoreClient eventStoreClient,
- IEventBus eventBus,
- ISubscriptionCheckpointRepository checkpointRepository,
- ILogger logger
- )
- {
- this.eventStoreClient = eventStoreClient ?? throw new ArgumentNullException(nameof(eventStoreClient));
- this.eventBus = eventBus ?? throw new ArgumentNullException(nameof(eventBus));
- this.checkpointRepository =
- checkpointRepository ?? throw new ArgumentNullException(nameof(checkpointRepository));
- this.logger = logger ?? throw new ArgumentNullException(nameof(logger));
- }
-
- public async Task SubscribeToAll(EventStoreDBSubscriptionToAllOptions subscriptionOptions, CancellationToken ct)
- {
- this.subscriptionOptions = subscriptionOptions;
- cancellationToken = ct;
-
- logger.LogInformation("Subscription to all '{SubscriptionId}'", subscriptionOptions.SubscriptionId);
-
- var checkpoint = await checkpointRepository.Load(SubscriptionId, ct);
-
- if (checkpoint != null)
- {
- await eventStoreClient.SubscribeToAllAsync(
- new Position(checkpoint.Value, checkpoint.Value),
- HandleEvent,
- subscriptionOptions.ResolveLinkTos,
- HandleDrop,
- subscriptionOptions.FilterOptions,
- subscriptionOptions.ConfigureOperation,
- subscriptionOptions.Credentials,
- ct
- );
- }
- else
- {
- await eventStoreClient.SubscribeToAllAsync(
- HandleEvent,
- false,
- HandleDrop,
- subscriptionOptions.FilterOptions,
- subscriptionOptions.ConfigureOperation,
- subscriptionOptions.Credentials,
- ct
- );
- }
-
- logger.LogInformation("Subscription to all '{SubscriptionId}' started", SubscriptionId);
- }
-
- private async Task HandleEvent(StreamSubscription subscription, ResolvedEvent resolvedEvent,
- CancellationToken ct)
- {
- try
- {
- if (IsEventWithEmptyData(resolvedEvent) || IsCheckpointEvent(resolvedEvent)) return;
-
- // publish event to internal event bus
- await eventBus.Publish(resolvedEvent, ct);
-
- await checkpointRepository.Store(SubscriptionId, resolvedEvent.Event.Position.CommitPosition, ct);
- }
- catch (Exception e)
- {
- logger.LogError("Error consuming message: {ExceptionMessage}{ExceptionStackTrace}", e.Message,
- e.StackTrace);
- }
- }
-
- private void HandleDrop(StreamSubscription _, SubscriptionDroppedReason reason, Exception? exception)
- {
- logger.LogError(
- exception,
- "Subscription to all '{SubscriptionId}' dropped with '{Reason}'",
- SubscriptionId,
- reason
- );
-
- Resubscribe();
- }
-
- private void Resubscribe()
- {
- while (true)
- {
- var resubscribed = false;
- try
- {
- Monitor.Enter(resubscribeLock);
-
- using (NoSynchronizationContextScope.Enter())
- {
- SubscribeToAll(subscriptionOptions, cancellationToken).Wait(cancellationToken);
- }
-
- resubscribed = true;
- }
- catch (Exception exception)
- {
- logger.LogWarning(exception,
- "Failed to resubscribe to all '{SubscriptionId}' dropped with '{ExceptionMessage}{ExceptionStackTrace}'",
- SubscriptionId, exception.Message, exception.StackTrace);
- }
- finally
- {
- Monitor.Exit(resubscribeLock);
- }
-
- if (resubscribed)
- break;
-
- Thread.Sleep(1000);
- }
- }
-
- private bool IsEventWithEmptyData(ResolvedEvent resolvedEvent)
- {
- if (resolvedEvent.Event.Data.Length != 0) return false;
-
- logger.LogInformation("Event without data received");
- return true;
- }
-
- private bool IsCheckpointEvent(ResolvedEvent resolvedEvent)
- {
- if (resolvedEvent.Event.EventType != EventTypeMapper.ToName()) return false;
-
- logger.LogInformation("Checkpoint event - ignoring");
- return true;
- }
- }
-
- public static class EventStoreDBSubscriptionToAllExtensions
- {
- public static IServiceCollection AddSubscriptionToAll(this IServiceCollection services,
- EventStoreDBSubscriptionToAllOptions? subscriptionOptions = null,
- bool checkpointToEventStoreDB = true)
- {
- if (checkpointToEventStoreDB)
- {
- services
- .AddTransient();
- }
-
- return services.AddHostedService(serviceProvider =>
- {
- var logger =
- serviceProvider.GetRequiredService>();
-
- var eventStoreDBSubscriptionToAll =
- serviceProvider.GetRequiredService();
-
- return new BackgroundWorker(
- logger,
- ct =>
- eventStoreDBSubscriptionToAll.SubscribeToAll(
- subscriptionOptions ?? new EventStoreDBSubscriptionToAllOptions(),
- ct
- )
- );
- }
- );
- }
- }
-}
diff --git a/Sample/EventStoreDB/DataAnalytics/DataAnalytics.Core/Subscriptions/ISubscriptionCheckpointRepository.cs b/Sample/EventStoreDB/DataAnalytics/DataAnalytics.Core/Subscriptions/ISubscriptionCheckpointRepository.cs
deleted file mode 100644
index 04490fe60..000000000
--- a/Sample/EventStoreDB/DataAnalytics/DataAnalytics.Core/Subscriptions/ISubscriptionCheckpointRepository.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace DataAnalytics.Core.Subscriptions
-{
- public interface ISubscriptionCheckpointRepository
- {
- ValueTask Load(string subscriptionId, CancellationToken ct);
-
- ValueTask Store(string subscriptionId, ulong position, CancellationToken ct);
- }
-}
diff --git a/Sample/EventStoreDB/DataAnalytics/DataAnalytics.Core/Threading/NoSynchronizationContextScope.cs b/Sample/EventStoreDB/DataAnalytics/DataAnalytics.Core/Threading/NoSynchronizationContextScope.cs
deleted file mode 100644
index 822737fd1..000000000
--- a/Sample/EventStoreDB/DataAnalytics/DataAnalytics.Core/Threading/NoSynchronizationContextScope.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-using System;
-using System.Threading;
-
-namespace DataAnalytics.Core.Threading
-{
- public static class NoSynchronizationContextScope
- {
- public static Disposable Enter()
- {
- var context = SynchronizationContext.Current;
- SynchronizationContext.SetSynchronizationContext(null);
- return new Disposable(context);
- }
-
- public struct Disposable: IDisposable
- {
- private readonly SynchronizationContext? synchronizationContext;
-
- public Disposable(SynchronizationContext? synchronizationContext)
- {
- this.synchronizationContext = synchronizationContext;
- }
-
- public void Dispose() =>
- SynchronizationContext.SetSynchronizationContext(synchronizationContext);
- }
- }
-}
diff --git a/Sample/EventStoreDB/DataAnalytics/ECommerce/ECommerce.csproj b/Sample/EventStoreDB/DataAnalytics/ECommerce/ECommerce.csproj
index 5d8e893da..129591403 100644
--- a/Sample/EventStoreDB/DataAnalytics/ECommerce/ECommerce.csproj
+++ b/Sample/EventStoreDB/DataAnalytics/ECommerce/ECommerce.csproj
@@ -1,13 +1,13 @@
- net6.0
+ net7.0
enable
true
-
+
diff --git a/Sample/EventStoreDB/DataAnalytics/MarketBasketAnalytics.Api/MarketBasketAnalytics.Api.csproj b/Sample/EventStoreDB/DataAnalytics/MarketBasketAnalytics.Api/MarketBasketAnalytics.Api.csproj
index 3eebe9b8c..4222227eb 100644
--- a/Sample/EventStoreDB/DataAnalytics/MarketBasketAnalytics.Api/MarketBasketAnalytics.Api.csproj
+++ b/Sample/EventStoreDB/DataAnalytics/MarketBasketAnalytics.Api/MarketBasketAnalytics.Api.csproj
@@ -1,17 +1,16 @@
- net6.0
+ net7.0
enable
true
-
+
-
diff --git a/Sample/EventStoreDB/DataAnalytics/MarketBasketAnalytics.Api/Startup.cs b/Sample/EventStoreDB/DataAnalytics/MarketBasketAnalytics.Api/Startup.cs
index 87fc9ff98..8ec2b8ce3 100644
--- a/Sample/EventStoreDB/DataAnalytics/MarketBasketAnalytics.Api/Startup.cs
+++ b/Sample/EventStoreDB/DataAnalytics/MarketBasketAnalytics.Api/Startup.cs
@@ -1,10 +1,6 @@
-using DataAnalytics.Core;
-using DataAnalytics.Core.Subscriptions;
-using Microsoft.AspNetCore.Builder;
-using Microsoft.AspNetCore.Hosting;
-using Microsoft.Extensions.Configuration;
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.Hosting;
+using Core;
+using Core.ElasticSearch;
+using Core.EventStoreDB;
using Microsoft.OpenApi.Models;
namespace MarketBasketAnalytics.Api
@@ -27,9 +23,10 @@ public void ConfigureServices(IServiceCollection services)
{
c.SwaggerDoc("v1", new OpenApiInfo { Title = "ECommerce.Api", Version = "v1" });
})
- .AddCoreServices(Configuration)
- .AddMarketBasketAnalytics()
- .AddSubscriptionToAll();
+ .AddEventStoreDB(Configuration)
+ .AddElasticsearch(Configuration)
+ .AddCoreServices()
+ .AddMarketBasketAnalytics(Configuration);
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
diff --git a/Sample/EventStoreDB/DataAnalytics/MarketBasketAnalytics/CartAbandonmentRateAnalysis/Configuration.cs b/Sample/EventStoreDB/DataAnalytics/MarketBasketAnalytics/CartAbandonmentRateAnalysis/Configuration.cs
index c000badf8..1e07208fe 100644
--- a/Sample/EventStoreDB/DataAnalytics/MarketBasketAnalytics/CartAbandonmentRateAnalysis/Configuration.cs
+++ b/Sample/EventStoreDB/DataAnalytics/MarketBasketAnalytics/CartAbandonmentRateAnalysis/Configuration.cs
@@ -1,9 +1,6 @@
-using System;
-using System.Threading;
-using System.Threading.Tasks;
-using DataAnalytics.Core.ElasticSearch;
-using DataAnalytics.Core.Entities;
-using DataAnalytics.Core.Events;
+using Core.ElasticSearch.Repository;
+using Core.Events;
+using Core.EventStoreDB.Events;
using EventStore.Client;
using MarketBasketAnalytics.Carts;
using Microsoft.Extensions.DependencyInjection;
@@ -20,12 +17,12 @@ public static IServiceCollection AddCartAbandonmentRateAnalysis(this IServiceCol
var eventStore = sp.GetRequiredService();
var @event = await CartAbandonmentRate.Handle(
- eventStore.AggregateStream,
+ (evolve, streamName, t) => eventStore.Find(evolve, streamName, t),
shoppingCartAbandoned,
ct
);
- await eventStore.AppendToNewStream(
+ await eventStore.Append(
CartAbandonmentRate.ToStreamId(shoppingCartAbandoned.ShoppingCartId),
@event,
ct
diff --git a/Sample/EventStoreDB/DataAnalytics/MarketBasketAnalytics/Configuration.cs b/Sample/EventStoreDB/DataAnalytics/MarketBasketAnalytics/Configuration.cs
index dbba7798b..44787a0da 100644
--- a/Sample/EventStoreDB/DataAnalytics/MarketBasketAnalytics/Configuration.cs
+++ b/Sample/EventStoreDB/DataAnalytics/MarketBasketAnalytics/Configuration.cs
@@ -1,12 +1,14 @@
-using MarketBasketAnalytics.CartAbandonmentRateAnalysis;
+using Core.EventStoreDB;
+using MarketBasketAnalytics.CartAbandonmentRateAnalysis;
using MarketBasketAnalytics.MarketBasketAnalysis;
+using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
namespace MarketBasketAnalytics
{
public static class Configuration
{
- public static IServiceCollection AddMarketBasketAnalytics(this IServiceCollection services) =>
+ public static IServiceCollection AddMarketBasketAnalytics(this IServiceCollection services, IConfiguration configuration) =>
services
.AddCartAbandonmentRateAnalysis()
.AddMarketBasketAnalysis();
diff --git a/Sample/EventStoreDB/DataAnalytics/MarketBasketAnalytics/MarketBasketAnalysis/CartProductItemsMatching.cs b/Sample/EventStoreDB/DataAnalytics/MarketBasketAnalytics/MarketBasketAnalysis/CartProductItemsMatching.cs
index 337fda5b0..71b9f4167 100644
--- a/Sample/EventStoreDB/DataAnalytics/MarketBasketAnalytics/MarketBasketAnalysis/CartProductItemsMatching.cs
+++ b/Sample/EventStoreDB/DataAnalytics/MarketBasketAnalytics/MarketBasketAnalysis/CartProductItemsMatching.cs
@@ -16,7 +16,7 @@ IReadOnlyList RelatedProducts
public static class CartProductItemsMatching
{
public static async Task> Handle(
- Func?, object, Dictionary>, string, CancellationToken, Task?>> aggregateStream,
+ Func, object, Dictionary>, string, CancellationToken, Task?>> aggregateStream,
ShoppingCartConfirmed @event,
CancellationToken ct
)
diff --git a/Sample/EventStoreDB/DataAnalytics/MarketBasketAnalytics/MarketBasketAnalysis/Configuration.cs b/Sample/EventStoreDB/DataAnalytics/MarketBasketAnalytics/MarketBasketAnalysis/Configuration.cs
index b0672cc8f..d2cedd93e 100644
--- a/Sample/EventStoreDB/DataAnalytics/MarketBasketAnalytics/MarketBasketAnalysis/Configuration.cs
+++ b/Sample/EventStoreDB/DataAnalytics/MarketBasketAnalytics/MarketBasketAnalysis/Configuration.cs
@@ -1,10 +1,7 @@
-using System;
-using System.Linq;
-using DataAnalytics.Core.Entities;
-using DataAnalytics.Core.Events;
-using DataAnalytics.Core.Serialisation;
+using Core.Events;
+using Core.EventStoreDB.Events;
+using Core.EventStoreDB.Serialization;
using EventStore.Client;
-using MarketBasketAnalytics.CartAbandonmentRateAnalysis;
using MarketBasketAnalytics.Carts;
using Microsoft.Extensions.DependencyInjection;
@@ -19,7 +16,7 @@ public static IServiceCollection AddMarketBasketAnalysis(this IServiceCollection
var eventStore = sp.GetRequiredService();
var events = await CartProductItemsMatching.Handle(
- eventStore.AggregateStream,
+ (evolve, streamName, t) => eventStore.Find(evolve, streamName, t),
shoppingCartConfirmed,
ct
);
diff --git a/Sample/EventStoreDB/DataAnalytics/MarketBasketAnalytics/MarketBasketAnalytics.csproj b/Sample/EventStoreDB/DataAnalytics/MarketBasketAnalytics/MarketBasketAnalytics.csproj
index 16dc344c3..8329190a3 100644
--- a/Sample/EventStoreDB/DataAnalytics/MarketBasketAnalytics/MarketBasketAnalytics.csproj
+++ b/Sample/EventStoreDB/DataAnalytics/MarketBasketAnalytics/MarketBasketAnalytics.csproj
@@ -1,17 +1,13 @@
- net6.0
+ net7.0
enable
true
-
-
-
-
-
+
@@ -23,4 +19,10 @@
+
+
+
+
+
+
diff --git a/Sample/EventStoreDB/ECommerce/Carts/Carts.Api.Tests/Carts.Api.Tests.csproj b/Sample/EventStoreDB/ECommerce/Carts/Carts.Api.Tests/Carts.Api.Tests.csproj
index f7f12e0ba..aeb16f34a 100644
--- a/Sample/EventStoreDB/ECommerce/Carts/Carts.Api.Tests/Carts.Api.Tests.csproj
+++ b/Sample/EventStoreDB/ECommerce/Carts/Carts.Api.Tests/Carts.Api.Tests.csproj
@@ -5,13 +5,13 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
@@ -19,10 +19,10 @@
-
-
+
+
-
+
diff --git a/Sample/EventStoreDB/ECommerce/Carts/Carts.Api/Carts.Api.csproj b/Sample/EventStoreDB/ECommerce/Carts/Carts.Api/Carts.Api.csproj
index 692e8d819..faf05401f 100644
--- a/Sample/EventStoreDB/ECommerce/Carts/Carts.Api/Carts.Api.csproj
+++ b/Sample/EventStoreDB/ECommerce/Carts/Carts.Api/Carts.Api.csproj
@@ -6,13 +6,13 @@
-
-
-
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
diff --git a/Sample/EventStoreDB/ECommerce/Carts/Carts.Tests/Carts.Tests.csproj b/Sample/EventStoreDB/ECommerce/Carts/Carts.Tests/Carts.Tests.csproj
index b9e315cff..8941b9d68 100644
--- a/Sample/EventStoreDB/ECommerce/Carts/Carts.Tests/Carts.Tests.csproj
+++ b/Sample/EventStoreDB/ECommerce/Carts/Carts.Tests/Carts.Tests.csproj
@@ -6,15 +6,15 @@
-
-
-
+
+
+
all
runtime; build; native; contentfiles; analyzers
-
+
diff --git a/Sample/EventStoreDB/Simple/ECommerce.Api.Tests/ECommerce.Api.Tests.csproj b/Sample/EventStoreDB/Simple/ECommerce.Api.Tests/ECommerce.Api.Tests.csproj
index 0516527d5..cb70b14e4 100644
--- a/Sample/EventStoreDB/Simple/ECommerce.Api.Tests/ECommerce.Api.Tests.csproj
+++ b/Sample/EventStoreDB/Simple/ECommerce.Api.Tests/ECommerce.Api.Tests.csproj
@@ -5,9 +5,9 @@
-
-
-
+
+
+
runtime; build; native; contentfiles; analyzers; buildtransitive
all
@@ -15,15 +15,15 @@
-
+
-
-
-
+
+
+
-
+
diff --git a/Sample/EventStoreDB/Simple/ECommerce.Api/ECommerce.Api.csproj b/Sample/EventStoreDB/Simple/ECommerce.Api/ECommerce.Api.csproj
index fb14abc3c..452a19fce 100644
--- a/Sample/EventStoreDB/Simple/ECommerce.Api/ECommerce.Api.csproj
+++ b/Sample/EventStoreDB/Simple/ECommerce.Api/ECommerce.Api.csproj
@@ -5,7 +5,7 @@
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/Sample/EventStoreDB/Simple/ECommerce.Core/ECommerce.Core.csproj b/Sample/EventStoreDB/Simple/ECommerce.Core/ECommerce.Core.csproj
index 69c433cee..e3abe8b61 100644
--- a/Sample/EventStoreDB/Simple/ECommerce.Core/ECommerce.Core.csproj
+++ b/Sample/EventStoreDB/Simple/ECommerce.Core/ECommerce.Core.csproj
@@ -7,18 +7,18 @@
-
+
-
-
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
diff --git a/Sample/EventStoreDB/Simple/ECommerce/ECommerce.csproj b/Sample/EventStoreDB/Simple/ECommerce/ECommerce.csproj
index 12ed5babc..37eb63617 100644
--- a/Sample/EventStoreDB/Simple/ECommerce/ECommerce.csproj
+++ b/Sample/EventStoreDB/Simple/ECommerce/ECommerce.csproj
@@ -7,18 +7,18 @@
-
+
-
-
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
diff --git a/Sample/EventsVersioning/EventsVersioning.Tests/EventsVersioning.Tests.csproj b/Sample/EventsVersioning/EventsVersioning.Tests/EventsVersioning.Tests.csproj
index bfc98943c..d7653d9e0 100644
--- a/Sample/EventsVersioning/EventsVersioning.Tests/EventsVersioning.Tests.csproj
+++ b/Sample/EventsVersioning/EventsVersioning.Tests/EventsVersioning.Tests.csproj
@@ -5,9 +5,9 @@
-
-
-
+
+
+
all
diff --git a/Sample/Helpdesk/Helpdesk.Api.Tests/Helpdesk.Api.Tests.csproj b/Sample/Helpdesk/Helpdesk.Api.Tests/Helpdesk.Api.Tests.csproj
index 475083029..0af5ca4b1 100644
--- a/Sample/Helpdesk/Helpdesk.Api.Tests/Helpdesk.Api.Tests.csproj
+++ b/Sample/Helpdesk/Helpdesk.Api.Tests/Helpdesk.Api.Tests.csproj
@@ -5,14 +5,14 @@
-
+
-
-
+
+
-
+
diff --git a/Sample/Helpdesk/Helpdesk.Api/Helpdesk.Api.csproj b/Sample/Helpdesk/Helpdesk.Api/Helpdesk.Api.csproj
index 9dc929bbe..4fb4796bc 100644
--- a/Sample/Helpdesk/Helpdesk.Api/Helpdesk.Api.csproj
+++ b/Sample/Helpdesk/Helpdesk.Api/Helpdesk.Api.csproj
@@ -5,9 +5,9 @@
-
+
-
+
diff --git a/Sample/HotelManagement/HotelManagement.Tests/HotelManagement.Tests.csproj b/Sample/HotelManagement/HotelManagement.Tests/HotelManagement.Tests.csproj
index 150fc1401..8e6f39110 100644
--- a/Sample/HotelManagement/HotelManagement.Tests/HotelManagement.Tests.csproj
+++ b/Sample/HotelManagement/HotelManagement.Tests/HotelManagement.Tests.csproj
@@ -10,14 +10,14 @@
-
-
+
+
all
runtime; build; native; contentfiles; analyzers
-
+
diff --git a/Sample/MeetingsManagement/MeetingsManagement.Api/MeetingsManagement.Api.csproj b/Sample/MeetingsManagement/MeetingsManagement.Api/MeetingsManagement.Api.csproj
index 260f1695b..fa4d19bd4 100644
--- a/Sample/MeetingsManagement/MeetingsManagement.Api/MeetingsManagement.Api.csproj
+++ b/Sample/MeetingsManagement/MeetingsManagement.Api/MeetingsManagement.Api.csproj
@@ -6,10 +6,10 @@
-
+
-
-
+
+
diff --git a/Sample/MeetingsManagement/MeetingsManagement.IntegrationTests/MeetingsManagement.IntegrationTests.csproj b/Sample/MeetingsManagement/MeetingsManagement.IntegrationTests/MeetingsManagement.IntegrationTests.csproj
index 9a138268b..80c9b4f6d 100644
--- a/Sample/MeetingsManagement/MeetingsManagement.IntegrationTests/MeetingsManagement.IntegrationTests.csproj
+++ b/Sample/MeetingsManagement/MeetingsManagement.IntegrationTests/MeetingsManagement.IntegrationTests.csproj
@@ -12,26 +12,26 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
all
runtime; build; native; contentfiles; analyzers
-
+
-
-
-
+
+
+
-
+
diff --git a/Sample/MeetingsManagement/MeetingsManagement/MeetingsManagement.csproj b/Sample/MeetingsManagement/MeetingsManagement/MeetingsManagement.csproj
index ded028e44..607ccb2ee 100644
--- a/Sample/MeetingsManagement/MeetingsManagement/MeetingsManagement.csproj
+++ b/Sample/MeetingsManagement/MeetingsManagement/MeetingsManagement.csproj
@@ -9,7 +9,7 @@
-
+
diff --git a/Sample/MeetingsManagement/MeetingsSearch.Api/MeetingsSearch.Api.csproj b/Sample/MeetingsManagement/MeetingsSearch.Api/MeetingsSearch.Api.csproj
index 257068635..633a04ef2 100644
--- a/Sample/MeetingsManagement/MeetingsSearch.Api/MeetingsSearch.Api.csproj
+++ b/Sample/MeetingsManagement/MeetingsSearch.Api/MeetingsSearch.Api.csproj
@@ -5,10 +5,10 @@
-
+
-
-
+
+
diff --git a/Sample/MeetingsManagement/MeetingsSearch.IntegrationTests/MeetingsSearch.IntegrationTests.csproj b/Sample/MeetingsManagement/MeetingsSearch.IntegrationTests/MeetingsSearch.IntegrationTests.csproj
index 9f33fddea..5c0b44820 100644
--- a/Sample/MeetingsManagement/MeetingsSearch.IntegrationTests/MeetingsSearch.IntegrationTests.csproj
+++ b/Sample/MeetingsManagement/MeetingsSearch.IntegrationTests/MeetingsSearch.IntegrationTests.csproj
@@ -12,25 +12,25 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
all
runtime; build; native; contentfiles; analyzers
-
+
-
-
+
+
-
+
diff --git a/Sample/Tickets/Tickets.Api.Tests/Tickets.Api.Tests.csproj b/Sample/Tickets/Tickets.Api.Tests/Tickets.Api.Tests.csproj
index ea520e29e..4ec62ffc9 100644
--- a/Sample/Tickets/Tickets.Api.Tests/Tickets.Api.Tests.csproj
+++ b/Sample/Tickets/Tickets.Api.Tests/Tickets.Api.Tests.csproj
@@ -5,14 +5,14 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
@@ -20,10 +20,10 @@
-
-
+
+
-
+
diff --git a/Sample/Tickets/Tickets.Api/Tickets.Api.csproj b/Sample/Tickets/Tickets.Api/Tickets.Api.csproj
index f5afdd935..721cd698d 100644
--- a/Sample/Tickets/Tickets.Api/Tickets.Api.csproj
+++ b/Sample/Tickets/Tickets.Api/Tickets.Api.csproj
@@ -5,10 +5,10 @@
-
+
-
-
+
+
diff --git a/Sample/Tickets/Tickets.Tests/Tickets.Tests.csproj b/Sample/Tickets/Tickets.Tests/Tickets.Tests.csproj
index 1e8d94950..61dca6e73 100644
--- a/Sample/Tickets/Tickets.Tests/Tickets.Tests.csproj
+++ b/Sample/Tickets/Tickets.Tests/Tickets.Tests.csproj
@@ -6,16 +6,16 @@
-
+
-
-
+
+
all
runtime; build; native; contentfiles; analyzers
-
+
diff --git a/Sample/Warehouse.MinimalAPI/Warehouse.Api/Warehouse.Api.csproj b/Sample/Warehouse.MinimalAPI/Warehouse.Api/Warehouse.Api.csproj
index cf894ae56..f1ab64370 100644
--- a/Sample/Warehouse.MinimalAPI/Warehouse.Api/Warehouse.Api.csproj
+++ b/Sample/Warehouse.MinimalAPI/Warehouse.Api/Warehouse.Api.csproj
@@ -7,15 +7,15 @@
-
-
-
-
+
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
+
+
diff --git a/Sample/Warehouse/Warehouse.Api.Tests/Warehouse.Api.Tests.csproj b/Sample/Warehouse/Warehouse.Api.Tests/Warehouse.Api.Tests.csproj
index dc812a640..996efbaad 100644
--- a/Sample/Warehouse/Warehouse.Api.Tests/Warehouse.Api.Tests.csproj
+++ b/Sample/Warehouse/Warehouse.Api.Tests/Warehouse.Api.Tests.csproj
@@ -5,9 +5,9 @@
-
-
-
+
+
+
runtime; build; native; contentfiles; analyzers; buildtransitive
all
@@ -16,13 +16,13 @@
-
+
-
-
-
+
+
+
@@ -38,6 +38,6 @@
-
+
diff --git a/Sample/Warehouse/Warehouse.Api/Warehouse.Api.csproj b/Sample/Warehouse/Warehouse.Api/Warehouse.Api.csproj
index 2a9212054..ac012f36c 100644
--- a/Sample/Warehouse/Warehouse.Api/Warehouse.Api.csproj
+++ b/Sample/Warehouse/Warehouse.Api/Warehouse.Api.csproj
@@ -5,10 +5,10 @@
-
-
-
-
+
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/Sample/Warehouse/Warehouse/Warehouse.csproj b/Sample/Warehouse/Warehouse/Warehouse.csproj
index e3dca9ad1..2d5de268b 100644
--- a/Sample/Warehouse/Warehouse/Warehouse.csproj
+++ b/Sample/Warehouse/Warehouse/Warehouse.csproj
@@ -18,12 +18,12 @@
-
-
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
diff --git a/Workshops/BuildYourOwnEventStore/01-CreateStreamsTable/01-CreateStreamsTable.csproj b/Workshops/BuildYourOwnEventStore/01-CreateStreamsTable/01-CreateStreamsTable.csproj
index 4d9ad8655..981486245 100644
--- a/Workshops/BuildYourOwnEventStore/01-CreateStreamsTable/01-CreateStreamsTable.csproj
+++ b/Workshops/BuildYourOwnEventStore/01-CreateStreamsTable/01-CreateStreamsTable.csproj
@@ -5,9 +5,9 @@
-
+
-
+
all
diff --git a/Workshops/BuildYourOwnEventStore/02-CreateEventsTable/02-CreateEventsTable.csproj b/Workshops/BuildYourOwnEventStore/02-CreateEventsTable/02-CreateEventsTable.csproj
index 4d9ad8655..981486245 100644
--- a/Workshops/BuildYourOwnEventStore/02-CreateEventsTable/02-CreateEventsTable.csproj
+++ b/Workshops/BuildYourOwnEventStore/02-CreateEventsTable/02-CreateEventsTable.csproj
@@ -5,9 +5,9 @@
-
+
-
+
all
diff --git a/Workshops/BuildYourOwnEventStore/03-CreateAppendEventFunction/03-CreateAppendEventFunction.csproj b/Workshops/BuildYourOwnEventStore/03-CreateAppendEventFunction/03-CreateAppendEventFunction.csproj
index 4d9ad8655..981486245 100644
--- a/Workshops/BuildYourOwnEventStore/03-CreateAppendEventFunction/03-CreateAppendEventFunction.csproj
+++ b/Workshops/BuildYourOwnEventStore/03-CreateAppendEventFunction/03-CreateAppendEventFunction.csproj
@@ -5,9 +5,9 @@
-
+
-
+
all
diff --git a/Workshops/BuildYourOwnEventStore/03-OptimisticConcurrency/03-OptimisticConcurrency.csproj b/Workshops/BuildYourOwnEventStore/03-OptimisticConcurrency/03-OptimisticConcurrency.csproj
index 4d9ad8655..981486245 100644
--- a/Workshops/BuildYourOwnEventStore/03-OptimisticConcurrency/03-OptimisticConcurrency.csproj
+++ b/Workshops/BuildYourOwnEventStore/03-OptimisticConcurrency/03-OptimisticConcurrency.csproj
@@ -5,9 +5,9 @@
-
+
-
+
all
diff --git a/Workshops/BuildYourOwnEventStore/04-EventStoreMethods/04-EventStoreMethods.csproj b/Workshops/BuildYourOwnEventStore/04-EventStoreMethods/04-EventStoreMethods.csproj
index 4d9ad8655..981486245 100644
--- a/Workshops/BuildYourOwnEventStore/04-EventStoreMethods/04-EventStoreMethods.csproj
+++ b/Workshops/BuildYourOwnEventStore/04-EventStoreMethods/04-EventStoreMethods.csproj
@@ -5,9 +5,9 @@
-
+
-
+
all
diff --git a/Workshops/BuildYourOwnEventStore/05-StreamAggregation/05-StreamAggregation.csproj b/Workshops/BuildYourOwnEventStore/05-StreamAggregation/05-StreamAggregation.csproj
index 4d9ad8655..981486245 100644
--- a/Workshops/BuildYourOwnEventStore/05-StreamAggregation/05-StreamAggregation.csproj
+++ b/Workshops/BuildYourOwnEventStore/05-StreamAggregation/05-StreamAggregation.csproj
@@ -5,9 +5,9 @@
-
+
-
+
all
diff --git a/Workshops/BuildYourOwnEventStore/06-TimeTraveling/06-TimeTraveling.csproj b/Workshops/BuildYourOwnEventStore/06-TimeTraveling/06-TimeTraveling.csproj
index 4d9ad8655..981486245 100644
--- a/Workshops/BuildYourOwnEventStore/06-TimeTraveling/06-TimeTraveling.csproj
+++ b/Workshops/BuildYourOwnEventStore/06-TimeTraveling/06-TimeTraveling.csproj
@@ -5,9 +5,9 @@
-
+
-
+
all
diff --git a/Workshops/BuildYourOwnEventStore/07-AggregateAndRepository/07-AggregateAndRepository.csproj b/Workshops/BuildYourOwnEventStore/07-AggregateAndRepository/07-AggregateAndRepository.csproj
index 4d9ad8655..981486245 100644
--- a/Workshops/BuildYourOwnEventStore/07-AggregateAndRepository/07-AggregateAndRepository.csproj
+++ b/Workshops/BuildYourOwnEventStore/07-AggregateAndRepository/07-AggregateAndRepository.csproj
@@ -5,9 +5,9 @@
-
+
-
+
all
diff --git a/Workshops/BuildYourOwnEventStore/08-Snapshots/08-Snapshots.csproj b/Workshops/BuildYourOwnEventStore/08-Snapshots/08-Snapshots.csproj
index 4d9ad8655..981486245 100644
--- a/Workshops/BuildYourOwnEventStore/08-Snapshots/08-Snapshots.csproj
+++ b/Workshops/BuildYourOwnEventStore/08-Snapshots/08-Snapshots.csproj
@@ -5,9 +5,9 @@
-
+
-
+
all
diff --git a/Workshops/BuildYourOwnEventStore/09-Projections/09-Projections.csproj b/Workshops/BuildYourOwnEventStore/09-Projections/09-Projections.csproj
index 4d9ad8655..981486245 100644
--- a/Workshops/BuildYourOwnEventStore/09-Projections/09-Projections.csproj
+++ b/Workshops/BuildYourOwnEventStore/09-Projections/09-Projections.csproj
@@ -5,9 +5,9 @@
-
+
-
+
all
diff --git a/Workshops/BuildYourOwnEventStore/10-ProjectionsWithMarten/10-ProjectionsWithMarten.csproj b/Workshops/BuildYourOwnEventStore/10-ProjectionsWithMarten/10-ProjectionsWithMarten.csproj
index 4d9ad8655..981486245 100644
--- a/Workshops/BuildYourOwnEventStore/10-ProjectionsWithMarten/10-ProjectionsWithMarten.csproj
+++ b/Workshops/BuildYourOwnEventStore/10-ProjectionsWithMarten/10-ProjectionsWithMarten.csproj
@@ -5,9 +5,9 @@
-
+
-
+
all
diff --git a/Workshops/BuildYourOwnEventStore/EventStoreBasics.Tests/EventStoreBasics.Tests.csproj b/Workshops/BuildYourOwnEventStore/EventStoreBasics.Tests/EventStoreBasics.Tests.csproj
index 93c029496..0ccd418b3 100644
--- a/Workshops/BuildYourOwnEventStore/EventStoreBasics.Tests/EventStoreBasics.Tests.csproj
+++ b/Workshops/BuildYourOwnEventStore/EventStoreBasics.Tests/EventStoreBasics.Tests.csproj
@@ -5,10 +5,10 @@
-
-
-
-
+
+
+
+
all
runtime; build; native; contentfiles; analyzers
@@ -16,10 +16,10 @@
-
-
+
+
-
+
diff --git a/Workshops/IntroductionToEventSourcing/01-EventsDefinition/01-EventsDefinition.csproj b/Workshops/IntroductionToEventSourcing/01-EventsDefinition/01-EventsDefinition.csproj
index 67fd80d80..10c2ca625 100644
--- a/Workshops/IntroductionToEventSourcing/01-EventsDefinition/01-EventsDefinition.csproj
+++ b/Workshops/IntroductionToEventSourcing/01-EventsDefinition/01-EventsDefinition.csproj
@@ -6,9 +6,9 @@
-
+
-
+
all
diff --git a/Workshops/IntroductionToEventSourcing/02-GettingStateFromEvents/02-GettingStateFromEvents.csproj b/Workshops/IntroductionToEventSourcing/02-GettingStateFromEvents/02-GettingStateFromEvents.csproj
index 87a360ae6..566ba2a6c 100644
--- a/Workshops/IntroductionToEventSourcing/02-GettingStateFromEvents/02-GettingStateFromEvents.csproj
+++ b/Workshops/IntroductionToEventSourcing/02-GettingStateFromEvents/02-GettingStateFromEvents.csproj
@@ -6,9 +6,9 @@
-
+
-
+
all
diff --git a/Workshops/IntroductionToEventSourcing/03-AppendingEvents.Marten/03-AppendingEvents.Marten.csproj b/Workshops/IntroductionToEventSourcing/03-AppendingEvents.Marten/03-AppendingEvents.Marten.csproj
index 9ba0280e0..ea830d1cb 100644
--- a/Workshops/IntroductionToEventSourcing/03-AppendingEvents.Marten/03-AppendingEvents.Marten.csproj
+++ b/Workshops/IntroductionToEventSourcing/03-AppendingEvents.Marten/03-AppendingEvents.Marten.csproj
@@ -6,9 +6,9 @@
-
+
-
+
all
diff --git a/Workshops/IntroductionToEventSourcing/04-AppendingEvents.EventStoreDB/04-AppendingEvents.EventStoreDB.csproj b/Workshops/IntroductionToEventSourcing/04-AppendingEvents.EventStoreDB/04-AppendingEvents.EventStoreDB.csproj
index a6977bdfe..03b156f3b 100644
--- a/Workshops/IntroductionToEventSourcing/04-AppendingEvents.EventStoreDB/04-AppendingEvents.EventStoreDB.csproj
+++ b/Workshops/IntroductionToEventSourcing/04-AppendingEvents.EventStoreDB/04-AppendingEvents.EventStoreDB.csproj
@@ -7,8 +7,8 @@
-
-
+
+
all
diff --git a/Workshops/IntroductionToEventSourcing/05-GettingStateFromEvents.Marten/05-GettingStateFromEvents.Marten.csproj b/Workshops/IntroductionToEventSourcing/05-GettingStateFromEvents.Marten/05-GettingStateFromEvents.Marten.csproj
index 87a360ae6..566ba2a6c 100644
--- a/Workshops/IntroductionToEventSourcing/05-GettingStateFromEvents.Marten/05-GettingStateFromEvents.Marten.csproj
+++ b/Workshops/IntroductionToEventSourcing/05-GettingStateFromEvents.Marten/05-GettingStateFromEvents.Marten.csproj
@@ -6,9 +6,9 @@
-
+
-
+
all
diff --git a/Workshops/IntroductionToEventSourcing/06-GettingStateFromEvents.EventStoreDB/06-GettingStateFromEvents.EventStoreDB.csproj b/Workshops/IntroductionToEventSourcing/06-GettingStateFromEvents.EventStoreDB/06-GettingStateFromEvents.EventStoreDB.csproj
index 5a5365111..52c0cdbbb 100644
--- a/Workshops/IntroductionToEventSourcing/06-GettingStateFromEvents.EventStoreDB/06-GettingStateFromEvents.EventStoreDB.csproj
+++ b/Workshops/IntroductionToEventSourcing/06-GettingStateFromEvents.EventStoreDB/06-GettingStateFromEvents.EventStoreDB.csproj
@@ -7,8 +7,8 @@
-
-
+
+
all
diff --git a/Workshops/IntroductionToEventSourcing/07-BusinessLogic/07-BusinessLogic.csproj b/Workshops/IntroductionToEventSourcing/07-BusinessLogic/07-BusinessLogic.csproj
index e64f1c50e..e9b6d86da 100644
--- a/Workshops/IntroductionToEventSourcing/07-BusinessLogic/07-BusinessLogic.csproj
+++ b/Workshops/IntroductionToEventSourcing/07-BusinessLogic/07-BusinessLogic.csproj
@@ -6,8 +6,8 @@
-
-
+
+
all
diff --git a/Workshops/IntroductionToEventSourcing/08-BusinessLogic.Marten/08-BusinessLogic.Marten.csproj b/Workshops/IntroductionToEventSourcing/08-BusinessLogic.Marten/08-BusinessLogic.Marten.csproj
index 8f279cf1f..2d3f75d39 100644
--- a/Workshops/IntroductionToEventSourcing/08-BusinessLogic.Marten/08-BusinessLogic.Marten.csproj
+++ b/Workshops/IntroductionToEventSourcing/08-BusinessLogic.Marten/08-BusinessLogic.Marten.csproj
@@ -6,9 +6,9 @@
-
+
-
+
all
diff --git a/Workshops/IntroductionToEventSourcing/09-BusinessLogic.EventStoreDB/09-BusinessLogic.EventStoreDB.csproj b/Workshops/IntroductionToEventSourcing/09-BusinessLogic.EventStoreDB/09-BusinessLogic.EventStoreDB.csproj
index 4ddd39227..f75b2a815 100644
--- a/Workshops/IntroductionToEventSourcing/09-BusinessLogic.EventStoreDB/09-BusinessLogic.EventStoreDB.csproj
+++ b/Workshops/IntroductionToEventSourcing/09-BusinessLogic.EventStoreDB/09-BusinessLogic.EventStoreDB.csproj
@@ -7,8 +7,8 @@
-
-
+
+
all
diff --git a/Workshops/IntroductionToEventSourcing/10-OptimisticConcurrency.Marten/10-OptimisticConcurrency.Marten.csproj b/Workshops/IntroductionToEventSourcing/10-OptimisticConcurrency.Marten/10-OptimisticConcurrency.Marten.csproj
index b6892d6c3..cb27903ce 100644
--- a/Workshops/IntroductionToEventSourcing/10-OptimisticConcurrency.Marten/10-OptimisticConcurrency.Marten.csproj
+++ b/Workshops/IntroductionToEventSourcing/10-OptimisticConcurrency.Marten/10-OptimisticConcurrency.Marten.csproj
@@ -6,9 +6,9 @@
-
+
-
+
all
diff --git a/Workshops/IntroductionToEventSourcing/11-OptimisticConcurrency.EventStoreDB/11-OptimisticConcurrency.EventStoreDB.csproj b/Workshops/IntroductionToEventSourcing/11-OptimisticConcurrency.EventStoreDB/11-OptimisticConcurrency.EventStoreDB.csproj
index 55c20b2ad..73cbf7e4f 100644
--- a/Workshops/IntroductionToEventSourcing/11-OptimisticConcurrency.EventStoreDB/11-OptimisticConcurrency.EventStoreDB.csproj
+++ b/Workshops/IntroductionToEventSourcing/11-OptimisticConcurrency.EventStoreDB/11-OptimisticConcurrency.EventStoreDB.csproj
@@ -7,8 +7,8 @@
-
-
+
+
all
diff --git a/Workshops/IntroductionToEventSourcing/12-Projections.SingleStream/12-Projections.SingleStream.csproj b/Workshops/IntroductionToEventSourcing/12-Projections.SingleStream/12-Projections.SingleStream.csproj
index 87a360ae6..566ba2a6c 100644
--- a/Workshops/IntroductionToEventSourcing/12-Projections.SingleStream/12-Projections.SingleStream.csproj
+++ b/Workshops/IntroductionToEventSourcing/12-Projections.SingleStream/12-Projections.SingleStream.csproj
@@ -6,9 +6,9 @@
-
+
-
+
all
diff --git a/Workshops/IntroductionToEventSourcing/13-Projections.SingleStream.Idempotency/13-Projections.SingleStream.Idempotency.csproj b/Workshops/IntroductionToEventSourcing/13-Projections.SingleStream.Idempotency/13-Projections.SingleStream.Idempotency.csproj
index 87a360ae6..566ba2a6c 100644
--- a/Workshops/IntroductionToEventSourcing/13-Projections.SingleStream.Idempotency/13-Projections.SingleStream.Idempotency.csproj
+++ b/Workshops/IntroductionToEventSourcing/13-Projections.SingleStream.Idempotency/13-Projections.SingleStream.Idempotency.csproj
@@ -6,9 +6,9 @@
-
+
-
+
all
diff --git a/Workshops/IntroductionToEventSourcing/14-Projections.SingleStream.EventualConsistency/14-Projections.SingleStream.EventualConsistency.csproj b/Workshops/IntroductionToEventSourcing/14-Projections.SingleStream.EventualConsistency/14-Projections.SingleStream.EventualConsistency.csproj
index 87a360ae6..566ba2a6c 100644
--- a/Workshops/IntroductionToEventSourcing/14-Projections.SingleStream.EventualConsistency/14-Projections.SingleStream.EventualConsistency.csproj
+++ b/Workshops/IntroductionToEventSourcing/14-Projections.SingleStream.EventualConsistency/14-Projections.SingleStream.EventualConsistency.csproj
@@ -6,9 +6,9 @@
-
+
-
+
all
diff --git a/Workshops/IntroductionToEventSourcing/Solved/01-EventsDefinition/01-EventsDefinition.csproj b/Workshops/IntroductionToEventSourcing/Solved/01-EventsDefinition/01-EventsDefinition.csproj
index 4b4c73f60..5f508d402 100644
--- a/Workshops/IntroductionToEventSourcing/Solved/01-EventsDefinition/01-EventsDefinition.csproj
+++ b/Workshops/IntroductionToEventSourcing/Solved/01-EventsDefinition/01-EventsDefinition.csproj
@@ -6,9 +6,9 @@
-
+
-
+
all
@@ -20,6 +20,6 @@
-
+
diff --git a/Workshops/IntroductionToEventSourcing/Solved/02-GettingStateFromEvents/02-GettingStateFromEvents.csproj b/Workshops/IntroductionToEventSourcing/Solved/02-GettingStateFromEvents/02-GettingStateFromEvents.csproj
index 7bcf6ba4c..725cd5e1f 100644
--- a/Workshops/IntroductionToEventSourcing/Solved/02-GettingStateFromEvents/02-GettingStateFromEvents.csproj
+++ b/Workshops/IntroductionToEventSourcing/Solved/02-GettingStateFromEvents/02-GettingStateFromEvents.csproj
@@ -6,10 +6,10 @@
-
-
-
-
+
+
+
+
all
runtime; build; native; contentfiles; analyzers
@@ -20,6 +20,6 @@
-
+
diff --git a/Workshops/IntroductionToEventSourcing/Solved/03-AppendingEvents.Marten/03-AppendingEvents.Marten.csproj b/Workshops/IntroductionToEventSourcing/Solved/03-AppendingEvents.Marten/03-AppendingEvents.Marten.csproj
index 091188900..b8a62bfc9 100644
--- a/Workshops/IntroductionToEventSourcing/Solved/03-AppendingEvents.Marten/03-AppendingEvents.Marten.csproj
+++ b/Workshops/IntroductionToEventSourcing/Solved/03-AppendingEvents.Marten/03-AppendingEvents.Marten.csproj
@@ -6,10 +6,10 @@
-
-
-
-
+
+
+
+
all
runtime; build; native; contentfiles; analyzers
@@ -20,6 +20,6 @@
-
+
diff --git a/Workshops/IntroductionToEventSourcing/Solved/04-AppendingEvents.EventStoreDB/04-AppendingEvents.EventStoreDB.csproj b/Workshops/IntroductionToEventSourcing/Solved/04-AppendingEvents.EventStoreDB/04-AppendingEvents.EventStoreDB.csproj
index 794dbc052..8c48d44de 100644
--- a/Workshops/IntroductionToEventSourcing/Solved/04-AppendingEvents.EventStoreDB/04-AppendingEvents.EventStoreDB.csproj
+++ b/Workshops/IntroductionToEventSourcing/Solved/04-AppendingEvents.EventStoreDB/04-AppendingEvents.EventStoreDB.csproj
@@ -6,10 +6,10 @@
-
-
-
-
+
+
+
+
all
runtime; build; native; contentfiles; analyzers
@@ -20,6 +20,6 @@
-
+
diff --git a/Workshops/IntroductionToEventSourcing/Solved/05-GettingStateFromEvents.Marten/05-GettingStateFromEvents.Marten.csproj b/Workshops/IntroductionToEventSourcing/Solved/05-GettingStateFromEvents.Marten/05-GettingStateFromEvents.Marten.csproj
index 7bcf6ba4c..725cd5e1f 100644
--- a/Workshops/IntroductionToEventSourcing/Solved/05-GettingStateFromEvents.Marten/05-GettingStateFromEvents.Marten.csproj
+++ b/Workshops/IntroductionToEventSourcing/Solved/05-GettingStateFromEvents.Marten/05-GettingStateFromEvents.Marten.csproj
@@ -6,10 +6,10 @@
-
-
-
-
+
+
+
+
all
runtime; build; native; contentfiles; analyzers
@@ -20,6 +20,6 @@
-
+
diff --git a/Workshops/IntroductionToEventSourcing/Solved/06-GettingStateFromEvents.EventStoreDB/06-GettingStateFromEvents.EventStoreDB.csproj b/Workshops/IntroductionToEventSourcing/Solved/06-GettingStateFromEvents.EventStoreDB/06-GettingStateFromEvents.EventStoreDB.csproj
index d03c18e13..0c1fd7b9a 100644
--- a/Workshops/IntroductionToEventSourcing/Solved/06-GettingStateFromEvents.EventStoreDB/06-GettingStateFromEvents.EventStoreDB.csproj
+++ b/Workshops/IntroductionToEventSourcing/Solved/06-GettingStateFromEvents.EventStoreDB/06-GettingStateFromEvents.EventStoreDB.csproj
@@ -6,10 +6,10 @@
-
-
-
-
+
+
+
+
all
runtime; build; native; contentfiles; analyzers
@@ -20,6 +20,6 @@
-
+
diff --git a/Workshops/IntroductionToEventSourcing/Solved/07-BusinessLogic/07-BusinessLogic.csproj b/Workshops/IntroductionToEventSourcing/Solved/07-BusinessLogic/07-BusinessLogic.csproj
index 45ae9c84d..d3bb9d329 100644
--- a/Workshops/IntroductionToEventSourcing/Solved/07-BusinessLogic/07-BusinessLogic.csproj
+++ b/Workshops/IntroductionToEventSourcing/Solved/07-BusinessLogic/07-BusinessLogic.csproj
@@ -6,9 +6,9 @@
-
-
-
+
+
+
all
runtime; build; native; contentfiles; analyzers
@@ -19,6 +19,6 @@
-
+
diff --git a/Workshops/IntroductionToEventSourcing/Solved/08-BusinessLogic.Marten/08-BusinessLogic.Marten.csproj b/Workshops/IntroductionToEventSourcing/Solved/08-BusinessLogic.Marten/08-BusinessLogic.Marten.csproj
index 998e3b517..e5d0d1c42 100644
--- a/Workshops/IntroductionToEventSourcing/Solved/08-BusinessLogic.Marten/08-BusinessLogic.Marten.csproj
+++ b/Workshops/IntroductionToEventSourcing/Solved/08-BusinessLogic.Marten/08-BusinessLogic.Marten.csproj
@@ -6,10 +6,10 @@
-
-
-
-
+
+
+
+
all
runtime; build; native; contentfiles; analyzers
@@ -20,6 +20,6 @@
-
+
diff --git a/Workshops/IntroductionToEventSourcing/Solved/09-BusinessLogic.EventStoreDB/09-BusinessLogic.EventStoreDB.csproj b/Workshops/IntroductionToEventSourcing/Solved/09-BusinessLogic.EventStoreDB/09-BusinessLogic.EventStoreDB.csproj
index 0b7375893..a376099c7 100644
--- a/Workshops/IntroductionToEventSourcing/Solved/09-BusinessLogic.EventStoreDB/09-BusinessLogic.EventStoreDB.csproj
+++ b/Workshops/IntroductionToEventSourcing/Solved/09-BusinessLogic.EventStoreDB/09-BusinessLogic.EventStoreDB.csproj
@@ -6,10 +6,10 @@
-
-
-
-
+
+
+
+
all
runtime; build; native; contentfiles; analyzers
@@ -20,6 +20,6 @@
-
+
diff --git a/Workshops/IntroductionToEventSourcing/Solved/10-OptimisticConcurrency.Marten/10-OptimisticConcurrency.Marten.csproj b/Workshops/IntroductionToEventSourcing/Solved/10-OptimisticConcurrency.Marten/10-OptimisticConcurrency.Marten.csproj
index 227df9f92..ce5cfef6a 100644
--- a/Workshops/IntroductionToEventSourcing/Solved/10-OptimisticConcurrency.Marten/10-OptimisticConcurrency.Marten.csproj
+++ b/Workshops/IntroductionToEventSourcing/Solved/10-OptimisticConcurrency.Marten/10-OptimisticConcurrency.Marten.csproj
@@ -6,10 +6,10 @@
-
-
-
-
+
+
+
+
all
runtime; build; native; contentfiles; analyzers
@@ -20,6 +20,6 @@
-
+
diff --git a/Workshops/IntroductionToEventSourcing/Solved/11-OptimisticConcurrency.EventStoreDB/11-OptimisticConcurrency.EventStoreDB.csproj b/Workshops/IntroductionToEventSourcing/Solved/11-OptimisticConcurrency.EventStoreDB/11-OptimisticConcurrency.EventStoreDB.csproj
index 5be2ec441..90ad851bc 100644
--- a/Workshops/IntroductionToEventSourcing/Solved/11-OptimisticConcurrency.EventStoreDB/11-OptimisticConcurrency.EventStoreDB.csproj
+++ b/Workshops/IntroductionToEventSourcing/Solved/11-OptimisticConcurrency.EventStoreDB/11-OptimisticConcurrency.EventStoreDB.csproj
@@ -6,10 +6,10 @@
-
-
-
-
+
+
+
+
all
runtime; build; native; contentfiles; analyzers
@@ -20,6 +20,6 @@
-
+
diff --git a/Workshops/IntroductionToEventSourcing/Solved/12-Projections.SingleStream/12-Projections.SingleStream.csproj b/Workshops/IntroductionToEventSourcing/Solved/12-Projections.SingleStream/12-Projections.SingleStream.csproj
index 7bcf6ba4c..725cd5e1f 100644
--- a/Workshops/IntroductionToEventSourcing/Solved/12-Projections.SingleStream/12-Projections.SingleStream.csproj
+++ b/Workshops/IntroductionToEventSourcing/Solved/12-Projections.SingleStream/12-Projections.SingleStream.csproj
@@ -6,10 +6,10 @@
-
-
-
-
+
+
+
+
all
runtime; build; native; contentfiles; analyzers
@@ -20,6 +20,6 @@
-
+
diff --git a/Workshops/IntroductionToEventSourcing/Solved/13-Projections.SingleStream.Idempotency/13-Projections.SingleStream.Idempotency.csproj b/Workshops/IntroductionToEventSourcing/Solved/13-Projections.SingleStream.Idempotency/13-Projections.SingleStream.Idempotency.csproj
index 7bcf6ba4c..725cd5e1f 100644
--- a/Workshops/IntroductionToEventSourcing/Solved/13-Projections.SingleStream.Idempotency/13-Projections.SingleStream.Idempotency.csproj
+++ b/Workshops/IntroductionToEventSourcing/Solved/13-Projections.SingleStream.Idempotency/13-Projections.SingleStream.Idempotency.csproj
@@ -6,10 +6,10 @@
-
-
-
-
+
+
+
+
all
runtime; build; native; contentfiles; analyzers
@@ -20,6 +20,6 @@
-
+
diff --git a/Workshops/IntroductionToEventSourcing/Solved/14-Projections.SingleStream.EventualConsistency/14-Projections.SingleStream.EventualConsistency.csproj b/Workshops/IntroductionToEventSourcing/Solved/14-Projections.SingleStream.EventualConsistency/14-Projections.SingleStream.EventualConsistency.csproj
index 7bcf6ba4c..725cd5e1f 100644
--- a/Workshops/IntroductionToEventSourcing/Solved/14-Projections.SingleStream.EventualConsistency/14-Projections.SingleStream.EventualConsistency.csproj
+++ b/Workshops/IntroductionToEventSourcing/Solved/14-Projections.SingleStream.EventualConsistency/14-Projections.SingleStream.EventualConsistency.csproj
@@ -6,10 +6,10 @@
-
-
-
-
+
+
+
+
all
runtime; build; native; contentfiles; analyzers
@@ -20,6 +20,6 @@
-
+