From the course: Expert Domain-Driven Design (DDD) Implementation in .NET
Unlock the full course today
Join today to access over 24,900 courses taught by industry experts.
Refactoring the DbContext for handling domain events - .NET Tutorial
From the course: Expert Domain-Driven Design (DDD) Implementation in .NET
Refactoring the DbContext for handling domain events
- [Instructor] We're now working with entirely different data. So we need to refactor the DbContext and create a new data structure to store the domain events and their associated metadata. So here in the ClinicDbContext, we can actually remove the OnModeledCreating method, since it's no longer needed. And now, we need to create a new record. Let's name it ConsultationEventData. So, ConsultationEventData. And I want this to have an Id. And then, the AggregateId. The EventName is Data. And this is very important, AssemblyQualifiedName. So let's align those parameters, just like this. And now we're ready to change the Consultations property to use ConsultationEventData, just like this. In other words, the domain events will have this structure in the database after they're persisted. Speaking of which, we need to create a code for writing and reading data. We're going to do that in the next video.
Contents
-
-
-
-
-
-
-
-
(Locked)
Refactoring the AggregateRoot class for tracking events1m 52s
-
(Locked)
Implementing the first domain event to be tracked3m 50s
-
(Locked)
Implementing more domain events related to the consultation3m 10s
-
(Locked)
Refactoring the DbContext for handling domain events1m 23s
-
(Locked)
Persisting domain events in the database5m 33s
-
(Locked)
Loading domain events from the database7m 14s
-
(Locked)
-