Getting Started: Event Sourcing in .NET

Get started with Event Sourcing and CQRS in .NET

About This Course

Event Sourcing is a persistence design pattern. It is often mentioned alongside CQRS and DDD. In short, it is the practice of storing the events that lead up to the current state instead of storing the state itself, as one would do in a CRUD system with a normalized database. The assumption is that it is always possible to re-create the state from the events, but not the other way around. Especially when Event Sourcing is combined with CQRS architecture, it enables a whole new way of thinking about data in your applications. It enables point-in-time data and the possibility to process old events against new features retroactively. In this course, the Event Sourcing principles and patterns are introduced, and we build an entire CQRS application from scratch to demonstrate how things piece together. We are not using a ready-made framework for this, but we are trying to take away the magic by building our own. At the end of this course, you should be familiar with event sourcing and how it fits with CQRS architecture.

Course Curriculum

4h 1m 8 sections
Welcome
00:50 Free preview
What will you learn in this course?
01:10 Free preview
Who is the course for and prerequisites
01:39 Free preview
What is Event Sourcing?
06:05
Commands vs Events
03:39
Future, Present & Past
07:03
The relationship with DDD
03:37
Events, streams & aggregates
04:49
The command handler life cycle
04:03
CQRS architecture
06:42
Section recap
00:50
Introduction to our domain
06:33
Modelling Events & Commands
08:52
Value Types in commands & events
14:21
Making root entities
05:16
Building Command Handlers
19:23
Adding a Command Router
07:29
An exercise for you to make
01:49
Section recap
00:40
Introduction to the test base class
06:13
Writing event sourced tests
05:17
Making our tests more read readable
08:24
Another exercice
00:56
Section recap
00:42
What are we going to build?
02:32
A look at our starting point
06:24
Building a simple event store
08:54
Building a command API
04:10
Alternate API approaches
03:47
Finalizing & running our API
06:19
Exercise time again!
00:27
Section recap
00:40
Checking out the read API
07:06
Querying aggregate data
03:35
Building a projection system
29:38
Exercise
02:28
Section recap
00:42
The typical UI pattern
04:06
Introducing the SignalR Hub
06:41
Publishing our events over SignalR
09:48
A final exercise
00:45
Section recap
01:18
What can our system now do?
09:48
Beyond this course
04:03
Conclusion
00:55

Meet Your Instructor

Hannes Lowette

Hannes Lowette

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.

View all courses by Hannes Lowette

What's New

Deep Dive: Solution Architecture
course

Deep Dive: Solution Architecture

Master solution architecture and turn business needs into scalable, maintainable systems.

Learn More
Migrating: ASP.NET Web APIs to ASP.NET Core
course

Migrating: ASP.NET Web APIs to ASP.NET Core

A step-by-step process to migrate ASP.NET Web APIs from .NET Framework to ASP.NET Core.

Learn More
Getting Started: Caching in .NET
course

Getting Started: Caching in .NET

Let's make the hardest thing in programming easy for .NET software engineers.

Learn More
From Zero to Hero: Testing with xUnit in C#
course

From Zero to Hero: Testing with xUnit in C#

Learn how to test any codebase in .NET with the latest version of xUnit, the industry-standard testing library.

Learn More
Create a ChatGPT Console AI Chatbot in C#
blog

Create a ChatGPT Console AI Chatbot in C#

This walkthrough is your hands-on entry point to create a basic C# console application that talks to ChatGPT using the OpenAI API.

Learn More