Skip to content

Commit

Permalink
Little addition to docs on strong typed identifiers with FetchForWriting
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremydmiller committed Jan 24, 2025
1 parent f27c4a9 commit 2e97d85
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docs/events/projections/aggregate-projections.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,11 @@ public class Payment
Just note that for single stream aggregations, your strong typed identifier types will need to wrap either a `Guid` or
`string` depending on your application's `StreamIdentity`.

At this point, the `FetchForWriting` and `FetchForLatest` APIs do not directly support strongly typed identifiers and you
will have to just pass in the wrapped, primitive value like this:

snippet: sample_use_fetch_for_writing_with_strong_typed_identifier

## Aggregate Creation

::: tip
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using EventSourcingTests.Projections;
using JasperFx.Core;
using JasperFx.Core.Reflection;
using Marten;
using Marten.Events;
using Marten.Events.Aggregation;
using Marten.Events.Projections;
Expand Down Expand Up @@ -87,6 +88,15 @@ public async Task can_utilize_strong_typed_id_in_with_inline_aggregations()
payment.State.ShouldBe(PaymentState.Verified);
}

#region sample_use_fetch_for_writing_with_strong_typed_identifier

private async Task use_fetch_for_writing_with_strong_typed_identifier(PaymentId id, IDocumentSession session)
{
var stream = await session.Events.FetchForWriting<Payment>(id.Value);
}

#endregion

[Fact]
public async Task can_utilize_strong_typed_id_with_async_aggregation()
{
Expand Down

0 comments on commit 2e97d85

Please sign in to comment.