Why You Don't Need To Abstract Away EF Core With Clean Architecture

☄️ Master the Modular Monolith Architecture: https://bit.ly/3SXlzSt 📌 Accelerate your Clean Architecture skills: https://bit.ly/3PupkOJ 🚀 Support me on Patreon to access the source code:   / milanjovanovic   Clean Architecture says you can't reference external dependencies in the Application layer. EF Core would be considered an external dependency. So what can you do? Here's an example of how being pragmatic can lead to a more straightforward design. Maybe there's no need to implement a custom repository and unit of work. Use EF directly, and reap all of the benefits. Join my weekly .NET newsletter: https://www.milanjovanovic.tech Read my Blog here: https://www.milanjovanovic.tech/blog Subscribe for more:    / @milanjovanovictech   Chapters 0:00 Creating the Application layer 0:33 Installing MediatR and EF Core 1:13 Implementing the "Create Order" use case 2:39 Defining an EF Core DbContext abstraction 4:30 Implementing the use case with EF Core 6:05 Adding SaveChangesAsync 7:06 Benefits of directly using EF Core 7:48 Drawbacks of directly using EF Core 8:38 Configuring the Persistence layer