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 committed Dec 15, 2024
1 parent 11221b4 commit e9207e0
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 e9207e0

Please sign in to comment.