In this chapter, you’ll pull everything together by using ASP.NET Core to build a real web application. Using ASP.NET Core brings in issues that are outside EF Core, such as dependency injection (covered in section 5.4) and async/await (covered in section 5.10). But they’re necessary if you’re going to use EF Core in this type of application.
This chapter assumes that you’ve read chapters 2-4 and know about querying and updating the database and what business logic is. This chapter is about where to place your database access code and how to call it in a real application. It also covers the specific issues of using EF Core in an ASP.NET Core (including Blazor Server) applications. For that reason, this chapter includes quite a bit about ASP.NET Core, but it’s all focused on using EF Core well in this type of application. I end with more general information on various ways to obtain an instance of the application’s DbContext for cases such as background tasks.