I've noticed that many .NET projects have one thing in common - a very messy DbContext
full of entity configuration code.
Today I'll show you a simple trick to make your Entity Framework Core setup cleaner, easier to maintain, and much more scalable.
Here's a typical example of what I often see:
All entity configurations are written directly inside the DbContext
, making it long, cluttered, and difficult to navigate.
But there's a built-in EF Core feature that many developers overlook: ApplyConfigurationsFromAssembly
.
Let's see how it works in my video:
Top comments (0)