Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

Support for persistence to EventStoreDB. Fixes #3 #4

Merged
merged 10 commits into from
Oct 27, 2020

Conversation

jonclare
Copy link
Collaborator

No description provided.

…tion working.

Upgrading to .NET 5.0 should fix this as it supports working with classes without default constructors
dotnet/runtime#29895
@jonclare jonclare requested a review from daniel-smith October 22, 2020 13:50
@jonclare jonclare changed the title Support for persistence to EventStoreDB Support for persistence to EventStoreDB. Fixes #3 Oct 22, 2020
public static EventData ToEventData(this IEventSerializer @eventSerializer, object @event, string eventName)
{
var eventPersistenceData = eventSerializer.GetPersistenceData(@event, eventName);
return new EventData(eventPersistenceData.EventId, eventPersistenceData.EventName, eventPersistenceData.IsJsonBytes, eventPersistenceData.EventData, eventPersistenceData.EventMetadata);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dude wrap this 😛

…on fixes that allow JSON to be deserialized into classes without default constructors
@jonclare jonclare marked this pull request as ready for review October 26, 2020 16:07
{
_routes = ImmutableDictionary.CreateRange(routes);
EventNameMappings = eventNameMappings;
}

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we rename the interface to IEventNameMap, and the implementation to EventNameMap? Then the property here can also be called EventNameMap. Seems a bit more concise and consistent.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed

public async Task<long> SaveEventsAsync<TEvent>(string streamName, long expectedStreamVersion, IEnumerable<TEvent> events)
{
var eventDatas = events.Select(e => _serializer.ToEventData(e));

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we have an issue to address this TODO?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created #8

}

private static string DetermineEventNameForClrType(Type clrType)
{
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this comment be part of a proper documentation comment somewhere?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll set up a proper wiki site where we can document usage properly.

@daniel-smith daniel-smith merged commit 8d112a4 into daniel-smith:develop Oct 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants