We have created and used data models or entities so far, but we haven't figured out how they are related. Let's understand how they are related and the terminologies used for those relationships.
We will revisit the data models we created and consumed in Chapter 1, Kickstart - Introduction to Entity Framework Core (using the Code-First approach), which could be used to understand the relationship terminologies. For illustration purposes, we will tweak those objects to understand different terminologies that were not used in the system.
The Blog
entity/data model we created using the Code First approach is displayed as follows:
public class Blog { public int Id { get; set; } public string Url { get; set; } public ICollection<Post> Posts { get; set; } }
We will be using the Blog
model to understand the following:
- Principal entity
- Principal key
- Navigational property