Releases: EventStore/samples
Updated .NET Crypto Shredding example to .NET 6, bumped packages to the latest version
- Updated .NET CQRS flow to .NET 6, bumped packages to the latest version
- Moved to file-scoped namespaces.
- Updated obsolete usage of
AesManaged
toAes.Create
. From: https://www.meziantou.net/cryptography-in-dotnet.htm#aes:"AESManaged is fully implemented in .NET, however, the implementation is not FIPS compliant. AESCryptoServiceProvider uses the Windows implementation (CryptoAPI) which is FIPS compliant. Or you can create an instance of the best available provider using AES.Create()."
Updated .NET CQRS flow to .NET 6, bumped packages to the latest version
- Updated .NET CQRS flow to .NET 6, bumped packages to the latest version
- Moved to file-scoped namespaces.
- Refactored and simplified Subscription to all processing.
- Fixed bug in the ElasticSearchProjection processing: Entity wasn't getting from the database because of missing index name.
- Added tests for:
- adding product item,
- removing product item,
- confirming shopping cart.
- Added
StreamEvent
wrapper to pass event metadata (e.g. to support idempotency in the projections). - Updated
ElasticSearchProjection
to generically support idempotency. - Hidden generic
Publish
method inEventBus
, as it may be getting the wrong Type (e.g. base class instead of the exact one). It's also redundant to keep it public, as the object has a method. - Updated
SubscribeToAll
logic to not fail when it wasn't possible to deserialise even. - Removed test report workflow, as it's flaky and not adding much value.
- Disabled Test parallelization for API tests to not have deadlocks on starting subscription host.
See details in: #12
Samples for Protecting Sensitive Data in Event-Sourced Systems with Crypto Shredding
This sample is showing an example of using the Crypto Shredding pattern with EventStoreDB. This can be a solution for handling, e.g. European General Data Protection Regulation.
Read more in the Diego Martin article "Protecting Sensitive Data in Event-Sourced Systems with Crypto Shredding".
Description
- shows how to Protecting Sensitive Data (e.g. for European General Data Protection Regulation) in Event-Sourced Systems.
- shows how to use the .NET
System.Security.Cryptography
library with AES algorithm to encrypt and decrypt events' data. - uses EventStoreDB.
Other changes:
Updated the CI configuring for showing test results to:
- not override each other if there are other changes
- be able to be run by external PR.
Unfortunately, that part is only to be verified once it's merged because of how GH is running the workflow triggers (the workflow file has to be on the main branch already).
See the source codes: https://github.com/EventStore/samples/tree/main/Crypto_Shredding/.NET and Pull Request.
Refactored the CQRS Flow .NET samples to not use MediatR
Refactoring of the CQRS Flow .NET example based on the feedback
- Removed MediatR library not to have a redundant dependency from the external package (no advanced features like pipelines were used)
- Removed marker interface for Commands, Queries and Events to reduce potential ceremony
Added sample for Event Sourcing with CQRS flow in .NET
Overview
It uses:
- Provides the example of the Aggregate,
- Stores events to EventStoreDB,
- Builds read models using Subscription to
$all
. - Read models are stored as ElasticSearch documents.
- CQRS with MediatR,
- App has Swagger and predefined docker-compose to run and play with samples.
Write Model
- Provides the basic boilerplate together with Core projects,
- EventStoreDBRepository repository to load and store aggregate state,
- IProjection interface to handle the same way stream aggregation and materialised projections,
- Thanks to that added dedicated AggregateStream method for stream aggregation
- See sample Aggregate and base class
Read Model
- Read models are rebuilt with eventual consistency using subscribe to all EventStoreDB feature,
- Added hosted service SubscribeToAllBackgroundWorker to handle subscribing to all. It handles checkpointing and simple retries if the connection was dropped.
- Added ISubscriptionCheckpointRepository for handling Subscription checkpointing.
- Added checkpointing to EventStoreDB stream with EventStoreDBSubscriptionCheckpointRepository and dummy in-memory checkpointer InMemorySubscriptionCheckpointRepository,
- Added ElasticSearchProjection as a sample how to project with
left-fold
into external storage. Another (e.g. MongoDB, EntityFramework) can be implemented the same way.
Tests
- Added sample of unit testing in
Carts.Tests
: - Added sample of integration testing in
Carts.Api.Tests
Other
- EventTypeMapper class to allow both convention-based mapping (by the .NET type name) and custom to handle event versioning,
- StreamNameMapper class for convention-based id (and optional tenant) mapping based on the stream type and module,
- IoC registration helpers for EventStoreDB configuration,