Introduction
Unleash the power of Domain-Driven Design in your .NET projects
()
What you should know
()
Preparing the development environment
()
Domain-Driven Design refresher
()
Understanding what you are going to build
()
1. Defining and Implementing Entities and Value Objects
Creating the initial project for the Management domain model
()
Implementing an entity
()
Refactoring the logic into an entity base class
()
Encapsulating and protecting entity state
()
Avoiding the primitive obsession anti-pattern
()
Implementing a value object for a pet's weight
()
Implementing a second entity for pet breeds
()
Invoking a domain service in a value object
()
Implementing business rules in the Pet entity
()
Implementing implicit operators in value objects
()
2. Defining and Implementing Aggregates
Refactoring the solution to add a shared kernel mapping
()
Adding necessary properties to the aggregate
()
Implementing logic in the aggregate to end a consultation
()
Implementing behavior to manage drugs
()
Implementing behavior to record multiple vital sign readings
()
Unit testing the aggregate
()
3. Implementing the Infrastructure Layer
Creating the ManagementDbContext
()
Configuring type and property mappings in the DbContext
()
Registering the DbContext in the dependency injection container
()
Refactoring the code into a repository interface and class
()
4. Implementing the Application Layer
Implementing the ManagementApplicationService class
()
Persisting data in the ManagementApplicationService class
()
Rehydrating persisted entities and invoking their behavior
()
Creating a command handler interface for handling commands
()
Challenge: Implementing the Clinic API
()
Solution: Implementing the Clinic API
()
Challenge: Refactoring the consultation date and time
()
Solution: Refactoring the consultation date and time
()
5. Implementing Domain Events
Implementing domain events
()
Publishing domain events
()
Subscribing to domain events
()
6. Mixing the Event Sourcing Pattern with DDD
Refactoring the AggregateRoot class for tracking events
()
Implementing the first domain event to be tracked
()
Implementing more domain events related to the consultation
()
Refactoring the DbContext for handling domain events
()
Persisting domain events in the database
()
Loading domain events from the database
()
Conclusion
Next steps in Domain-Driven Design (DDD)
()