Data Access in ASP.NET Core (Part 2 – Entity Relationships)
In Chapter 5, we introduced the fundamentals of Entity Framework Core (EF Core), including how to create a DbContext
class and how to use it to access data.
You can recap the basic concepts of relationships in Chapter 1, in the Defining the Relationships between Resources section, where we introduced relationships between resources. For example, in a blog system, a post has a collection of comments, and a user has a collection of posts. In an invoice system, an invoice has a collection of invoice items, and an invoice item belongs to an invoice. An invoice also has a contact, which can have one or more contact persons and can have one address.
In this chapter, we will continue to explore the features of EF Core. We will learn how to manage relationships between entities using Fluent APIs. Finally, we will discuss how to implement CRUD operations for entities with relationships.
We will cover the following topics...