Skip to content

Commit

Permalink
Removed Marten references
Browse files Browse the repository at this point in the history
  • Loading branch information
oskardudycz committed May 2, 2024
1 parent 46acc44 commit 5a22291
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@ namespace ApplicationLogic.Marten.Core.Marten;
public static class DocumentSessionExtensions
{
public static Task Add<T>(this IDocumentSession documentSession, Guid id, object @event, CancellationToken ct)
where T : class
{
documentSession.Events.StartStream<T>(id, @event);
return documentSession.SaveChangesAsync(token: ct);
}
where T : class =>
documentSession.Add<T>(id, [@event], ct);

public static Task Add<T>(this IDocumentSession documentSession, Guid id, object[] events, CancellationToken ct)
where T : class
Expand All @@ -35,10 +32,10 @@ public static Task GetAndUpdate<T>(
Action<T> handle,
CancellationToken ct
) where T : class, IAggregate =>
documentSession.Events.WriteToAggregate<T>(id, stream =>
documentSession.GetAndUpdate<T>(id, state =>
{
var aggregate = stream.Aggregate ?? throw NotFoundException.For<T>(id);
handle(aggregate);
stream.AppendMany(aggregate.DequeueUncommittedEvents());
handle(state);
var events = state.DequeueUncommittedEvents();
return events;
}, ct);
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Marten.CommandLine" Version="7.8.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageReference Include="Marten.AspNetCore" Version="7.8.0" />
<PackageReference Include="Marten" Version="7.8.0" />
<PackageReference Include="EventStore.Client.Grpc.Streams" Version="23.2.1"/>
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
using ApplicationLogic.EventStoreDB.Immutable.ShoppingCarts;
using ApplicationLogic.EventStoreDB.Mixed.ShoppingCarts;
using ApplicationLogic.EventStoreDB.Mutable.ShoppingCarts;
using Marten;
using Microsoft.AspNetCore.Diagnostics;
using Oakton;

var builder = WebApplication.CreateBuilder(args);

Expand Down

0 comments on commit 5a22291

Please sign in to comment.