Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Little addition to docs on strong typed identifiers with FetchForWriting #3640

Merged
merged 1 commit into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading