Mapping DDD Domain Models with EF Core 2.1
summary
EF Core 2.1 maps rich DDD patterns so domain classes persist without a separate data model: it recognizes private backing fields and encapsulated collections (IEnumerable + private field) via SetPropertyAccessMode/HasField, maps value objects with OwnsOne, converts custom types with HasConversion, and lets the DbContext supply audit columns using shadow properties and an overridden SaveChanges. Demo code includes constructor injection, integration tests and model validation, notes lack of owned collections (owns many deferred to 3.0) and many-to-many still needs explicit join entities.
AI-written summary · about
chapters (13)
- 0:00Introduction to EF and DDD
- 2:35Bridging DDD and EF
- 5:03Tactical DDD Design
- 8:03EF Core as a Mapper
- 10:40EF Core Updates
- 12:22Domain Model Overview
- 14:26DDD Principles and Testing
- 17:55Encapsulating Properties
- 22:54Protecting Collections
- 28:55Mapping Value Objects
- 43:44One-to-One Relationships
- 49:23Value Conversions
- 51:42Shadow Properties and Summary
related talks
46mMapping Well-Designed Domain Models with EF Core 2.1
56mPractical Domain-Driven Design with EF Core
55mPractical Domain-Driven Design with EF Core
50mEntity Framework Core 2.2 and beyond: what's cooking?
58mImplementing Domain Driven Design as a Pragmatic .NET Developer
46mEntity Framework Core 2.1 – what’s new?
44m10 things you didn't know EF Core can do
59m10 things you didn't know EF Core can do
