Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request includes significant changes to the
sample
project to implement a CQRS (Command Query Responsibility Segregation) pattern using theAtc.Cosmos.EventStore.Cqrs
library. The most important changes include the addition of new commands, events, and projections, as well as the configuration of the Cosmos DB and Event Store.The getting started project is described in detail in a year old blog post I wrote on https://christianhelle.com/2024/02/atc-cosmos-eventstore-cqrs.html
Commands Implementation:
CreateCommand
,DeleteCommand
, andUpdateNameCommand
along with their respective handlers to handle the creation, deletion, and updating of entities. (sample/GettingStarted/Commands/CreateCommands.cs
,sample/GettingStarted/Commands/DeleteCommand.cs
,sample/GettingStarted/Commands/UpdateNameCommands.cs
) [1] [2] [3]Events Implementation:
AddedEvent
,AddressChangedEvent
,DeletedEvent
, andNameChangedEvent
to represent domain events. (sample/GettingStarted/Events/AddedEvent.cs
,sample/GettingStarted/Events/AddressChangedEvent.cs
,sample/GettingStarted/Events/DeletedEvent.cs
,sample/GettingStarted/Events/NameChangedEvent.cs
) [1] [2] [3] [4]Projections and Read Models:
SampleProjection
to update the read model based on the events. AddedSampleReadModel
to represent the read model andContainerInitializer
to initialize the Cosmos DB container. (sample/GettingStarted/Projections/SampleProjection.cs
,sample/GettingStarted/Projections/SampleReadModel.cs
,sample/GettingStarted/Projections/ContainerInitializer.cs
) [1] [2] [3]Configuration and Setup:
Program.cs
and added aConsoleHostedService
to execute commands. (sample/GettingStarted/Program.cs
,sample/GettingStarted/ConsoleHostedService.cs
) [1] [2]Cleanup:
.editorconfig
,directory.build.props
, anddirectory.build.targets
. (sample/.editorconfig
,sample/directory.build.props
,sample/directory.build.targets
) [1] [2] [3]