Skip to content

Commit

Permalink
Fixed bug where FetchForWriting (the overload accepting an expected v…
Browse files Browse the repository at this point in the history
…ersion) would throw an InvalidCastException when the aggregate is inline and UseIdentityMapForAggregates = true.
  • Loading branch information
Strythio authored and jeremydmiller committed Dec 16, 2024
1 parent 80f6ba7 commit 7154e3f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Marten/Events/Fetching/FetchInlinedPlan.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public async Task<IEventStream<TDoc>> FetchForWriting(DocumentSessionBase sessio
IDocumentStorage<TDoc, TId> storage = null;
if (session.Options.Events.UseIdentityMapForAggregates)
{
storage = (IDocumentStorage<TDoc, TId>)session.Options.Providers.StorageFor<TDoc>();
storage = session.Options.ResolveCorrectedDocumentStorage<TDoc, TId>(DocumentTracking.IdentityOnly);
// Opt into the identity map mechanics for this aggregate type just in case
// you're using a lightweight session
session.UseIdentityMapFor<TDoc>();
Expand Down

0 comments on commit 7154e3f

Please sign in to comment.