Data Access in ASP.NET Core (Part 3: Tips)
In Chapter 6, we learned how to manage relationships between entities using the EF Core Fluent API. We introduced three types of relationships: one-to-one, one-to-many, and many-to-many. We also learned how to perform CRUD operations on related entities. With the knowledge we gained from Chapter 6, we can now build a simple data access layer for most web API applications. However, there are still some scenarios that we need to handle properly. For example, how do we improve the performance of data access? And what should we do if there are concurrency conflicts?
In this chapter, we will cover some advanced topics related to data access in ASP.NET Core, including DbContext
pooling, performance optimization, raw SQL queries, and concurrency conflicts. We will also discuss some tips and tricks that can help you write better code.
We will cover the following topics:
DbContext
pooling- Tracking versus no-tracking queries
- IQueryable...