Skip to content

Add GetLowLevelAsync to event stores with provider test coverage#278

Open
MPapst wants to merge 4 commits into
mainfrom
mpapst/implement-lowlevel-eventstore
Open

Add GetLowLevelAsync to event stores with provider test coverage#278
MPapst wants to merge 4 commits into
mainfrom
mpapst/implement-lowlevel-eventstore

Conversation

@MPapst

@MPapst MPapst commented May 24, 2026

Copy link
Copy Markdown
Collaborator

Why

The low-level append API should be accessible from the existing IEventStore abstraction without introducing a second store interface. This change aligns provider behavior and makes low-level event appends available consistently across backends.

What changed

  • Added GetLowLevelAsync(Guid, CancellationToken) to IEventStore returning ILowLevelEventStream.
  • Implemented GetLowLevelAsync in all provider stores: InMemory, EntityFrameworkCore, FileSystem, MongoDB, and AzureCosmos.
  • Updated provider stream implementations to expose low-level append behavior through ILowLevelEventStream.
  • Removed the intermediate ILowLevelEventStore approach and related provider registrations.
  • Added/expanded integration tests for low-level stream retrieval and append behavior in:
    • Papst.EventsStore.InMemory.Tests
    • Papst.EventStore.EntityFrameworkCore.Tests (new)
    • Papst.EventStore.FileSystem.Tests (new)
    • Papst.EventStore.MongoDB.Tests
  • Added new test projects to Papst.EventStore.slnx.

Non-obvious fix included

While implementing FileSystem low-level coverage, a pre-existing System.Text.Json and Newtonsoft.Json.Linq.JObject round-trip issue surfaced. This PR adds a JObjectJsonConverter in the FileSystem provider and wires it into serialization/deserialization paths so persisted event documents deserialize correctly.

Notes for reviewers

  • MongoDB low-level tests rely on Testcontainers and require Docker at runtime.
  • Provider READMEs were updated to reflect IEventStore.GetLowLevelAsync(...) usage instead of a separate low-level store.

MPapst and others added 4 commits May 24, 2026 22:46
- Created ILowLevelEventStore interface in core Papst.EventStore project
- Added ILowLevelEventStream implementation to all event stream classes:
  - InMemoryEventStream
  - EntityFrameworkEventStream
  - FileSystemEventStream
  - MongoDBEventStream
- Implemented ILowLevelEventStore for all providers:
  - InMemoryLowLevelEventStore
  - EntityFrameworkCoreLowLevelEventStore
  - FileSystemLowLevelEventStore
  - MongoDBLowLevelEventStore
- Registered ILowLevelEventStore in all provider DI extensions
- Updated README files to document ILowLevelEventStore usage:
  - InMemory, EntityFrameworkCore, MongoDB READMEs updated
  - FileSystem README created
- Low-level event store enables handling events as raw JObject without compile-time type information

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Added GetLowLevelAsync(Guid, CancellationToken) -> Task<ILowLevelEventStream> to IEventStore interface
- Implemented in InMemoryEventStore, EntityFrameworkEventStore, FileSystemEventStore, MongoDBEventStore, and CosmosEventStore
- All stream classes implement both IEventStream and ILowLevelEventStream
- Fixed FileSystem JObject serialization bug: added JObjectJsonConverter for System.Text.Json
- Added test projects: Papst.EventStore.EntityFrameworkCore.Tests and Papst.EventStore.FileSystem.Tests
- Added GetLowLevelAsync integration tests to InMemory, MongoDB, EF Core, and FileSystem test projects

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant