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

Replaced (internal) Event<T> with IEvent<T> in docs #2776

Merged
merged 5 commits into from
Nov 21, 2023
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
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ env:
config: Release
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
node_version: 16.x
node_version: 18.x

jobs:
build-and-test-code:
Expand Down
2 changes: 1 addition & 1 deletion docs/events/metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var store = DocumentStore.For(opts =>
<sup><a href='https://github.com/JasperFx/marten/blob/master/src/Marten.Testing/Examples/MetadataUsage.cs#L114-L127' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_configureeventmetadata' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

The actual metadata is accessible from the `IEvent` interface or `Event<T>` event wrappers as shown below:
The actual metadata is accessible from the `IEvent` interface event wrappers as shown below (which are implemented by internal `Event<T>`):

<!-- snippet: sample_IEvent -->
<a id='snippet-sample_ievent'></a>
Expand Down
6 changes: 3 additions & 3 deletions docs/events/projections/aggregate-projections.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ public class TripProjection: SingleStreamProjection<Trip>
<sup><a href='https://github.com/JasperFx/marten/blob/master/src/Marten.AsyncDaemon.Testing/TestingSupport/TripProjectionWithCustomName.cs#L43-L73' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_tripprojection_aggregate' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

The `Create()` method has to return either the aggregate document type or `Task<T>` where `T` is the aggregate document type. There must be an argument for the specific event type or `Event<T>` where `T` is the event type if you need access to event metadata. You can also take in an `IQuerySession` if you need to look up additional data as part of the transformation or `IEvent` in addition to the exact event type just to get at event metadata.
The `Create()` method has to return either the aggregate document type or `Task<T>` where `T` is the aggregate document type. There must be an argument for the specific event type or `IEvent<T>` where `T` is the event type if you need access to event metadata. You can also take in an `IQuerySession` if you need to look up additional data as part of the transformation or `IEvent` in addition to the exact event type just to get at event metadata.

## Applying Changes to the Aggregate Document

Expand Down Expand Up @@ -303,7 +303,7 @@ public class TripProjection: SingleStreamProjection<Trip>
The `Apply()` methods can accept any combination of these arguments:

1. The actual event type
1. `Event<T>` where the `T` is the actual event type. Use this if you want access to the [event metadata](/events/metadata) like versions or timestamps.
1. `IEvent<T>` where the `T` is the actual event type. Use this if you want access to the [event metadata](/events/metadata) like versions or timestamps.
1. `IEvent` access the event metadata. It's perfectly valid to accept both `IEvent` for the metadata and the specific event type just out of convenience.
1. `IQuerySession` if you need to do additional data lookups
1. The aggregate type
Expand Down Expand Up @@ -405,7 +405,7 @@ public class TripProjection: SingleStreamProjection<Trip>
The `ShouldDelete()` method can take any combination of these arguments:

1. The actual event type
1. `Event<T>` where the `T` is the actual event type. Use this if you want access to the [event metadata](/events/metadata) like versions or timestamps.
1. `IEvent<T>` where the `T` is the actual event type. Use this if you want access to the [event metadata](/events/metadata) like versions or timestamps.
1. `IQuerySession` if you need to do additional data lookups
1. The aggregate type

Expand Down
4 changes: 2 additions & 2 deletions docs/events/projections/event-projections.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ that way. Your other option is to use either the `Create()` or `Project()` metho

The `Create()` method can accept these arguments:

* The actual event type or `Event<T>` where `T` is the event type. One of these is required
* The actual event type or `IEvent<T>` where `T` is the event type. One of these is required
* `IEvent` to get access to the event metadata
* Optionally take in `IDocumentOperations` if you need to access other data. This interface supports all the functionality of `IQuerySession`

Expand All @@ -106,7 +106,7 @@ The `Create()` method needs to return either:

The `Project()` methods can accept these arguments:

* The actual event type or `Event<T>` where `T` is the event type. One of these is required.
* The actual event type or `IEvent<T>` where `T` is the event type. One of these is required.
* `IEvent` to get access to the event metadata
* `IDocumentOperations` is mandatory, and this is what you'd use to register any document operations

Expand Down
6 changes: 3 additions & 3 deletions docs/events/projections/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ public class QuestParty
<sup><a href='https://github.com/JasperFx/marten/blob/master/src/EventSourcingTests/Projections/QuestParty.cs#L8-L30' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_questparty' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

New in Marten 1.2 is the ability to use `Event<T>` metadata within your projections, assuming that you're not trying to run the aggregations inline.
mysticmind marked this conversation as resolved.
Show resolved Hide resolved
Marten provides the ability to use `IEvent<T>` metadata within your projections, assuming that you're not trying to run the aggregations inline.

The syntax using the built in aggregation technique is to take in `Event<T>` as the argument to your `Apply(event)` methods,
where `T` is the event type you're interested in:
The syntax using the built in aggregation technique is to take in `IEvent<T>` as the argument to your `Apply(event)` methods,
where `T` is the event type you're interested is covered in [Single Stream Projections](/events/projections/aggregate-projections).

<!-- snippet: sample_QuestPartyWithEvents -->
mysticmind marked this conversation as resolved.
Show resolved Hide resolved
<a id='snippet-sample_questpartywithevents'></a>
Expand Down
2 changes: 1 addition & 1 deletion docs/events/querying.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public async Task load_event_stream_async(IDocumentSession session, Guid streamI
<sup><a href='https://github.com/JasperFx/marten/blob/master/src/EventSourcingTests/Examples/event_store_quickstart.cs#L117-L145' title='Snippet source file'>snippet source</a> | <a href='#snippet-sample_using-fetch-stream' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

The data returned is a list of `IEvent` objects, where each is a strongly-typed `Event<T>` object shown below:
The data returned is a list of `IEvent` objects, where each is a (internal) strongly-typed `Event<T>` object shown below:

<!-- snippet: sample_IEvent -->
<a id='snippet-sample_ievent'></a>
Expand Down
2 changes: 1 addition & 1 deletion src/Marten/Events/Projections/Examples.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public DocumentAttribute(Type documentType)
public Type DocumentType { get; }
}

// All the signatures could take in IQuerySession, or Event<T>
// All the signatures could take in IQuerySession, or IEvent<T>
public class SomeDocument1Projector
{
public SomeDocument1 Create(SomeEvent1 event1)
Expand Down
Loading