Event Sourcing is a foundational design pattern in persistence architecture, frequently discussed in conjunction with CQRS and DDD. It revolves around the concept of capturing the events that lead to the current state instead of just storing the state itself, as traditionally done in CRUD systems with normalized databases. This approach operates on the premise that the current state can always be reconstructed from the sequence of events, but not the reverse. In our Deep Dive course, we will explore Event Sourcing in greater detail, utilizing the Marten library to implement a robust, production-ready event sourcing system. This course aims to provide a thorough understanding of the principles and patterns of Event Sourcing, diving deeper into its integration with CQRS architecture. By leveraging Marten, you will gain practical experience in building an application that effectively captures and processes events, showcasing how to create a powerful and flexible data management solution. Throughout the course, we will demystify the process of implementing event sourcing, enabling you to understand and utilize its capabilities fully. By the end of this Deep Dive course, you will have a comprehensive understanding of Event Sourcing, its intricate relationship with CQRS architecture, and the tools you need to implement it successfully in a production environment.
Welcome (00:39)
What will you learn in this course? (00:51)
Who is the course for and prerequisites (01:00)
Chapter introduction (00:38)
Setting up PostgreSQL (04:06)
What is Marten? (03:36)
A quick refresher of our domain (02:18)
Writing some events to a stream (09:25)
Applying events to an aggregate (10:05)
Projecting events (11:31)
Where will Marten fit into our CQRS architecture? (02:59)
Recap (00:40)
Outline of our plan (01:19)
Making the command handlers work (17:24)
A disclaimer on abstractions (01:46)
Marten's test strategy (03:49)
Making our unit tests work again (23:18)
Using Marten's projection system (24:05)
Using subscriptions for our UI (10:36)
Solution cleanup (02:24)
Recap (02:10)
What you should try to avoid (02:55)
Is it really the same event? (01:51)
Making non-breaking changes (07:54)
Contract-breaking changes (07:29)
Writing new streams (05:45)
Recap (03:08)
Introduction (00:45)
Where & When do projections run? (09:34)
Single Stream Projections (07:42)
Multi-Stream Projections (06:48)
Testing Projections (08:34)
Recap (02:01)
Why do we need more info? (02:43)
A quick refactor (10:38)
Logging commands (11:25)
Adding event metadata (06:59)
Recap (01:20)
Why do we need snapshots? (04:28)
Marten's built-in snapshots (09:40)
Dealing with concurrency issues (06:34)
Custom snapshots (07:00)
Recap (00:39)
Integration scenarios (01:40)
Event Subscriptions (06:59)
The Saga Pattern (09:32)
Recap (01:13)
Further resources (02:58)
Conclusion (01:35)
Course Info
Lifetime access
Add to Cart
With 20 years in .NET development, Hannes has always been passionate about performance, databases, distributed systems and large-scale applications. When it comes to architecture, his opinions have become a bit more nuanced, and the "it depends" card, however boring, gets played in many technical discussions. Hannes has always had a passion for sharing knowledge. It doesn't matter whether it is one-to-one while pair programming, on a conference stage giving a talk or when he's helping people succeed in their careers as a coach. In his free time, when he's not building LEGO® castles with his three kids, he likes to stream his guitar building on Twitch and spends too much time playing online chess and doing all-around geeky stuff. You can always lure him into a chat over a glass of great Whisky.
More courses by Hannes Lowette© 2025 Dometrain. All rights reserved.