concept dependent entity in category entity framework
appears as: dependent entity, dependent entities, dependent entities, dependent entity, The dependent entities

This is an excerpt from Manning's book Entity Framework Core in Action.
Dependent entity—Contains the foreign key property(s) that refers to the principal entity
Figure 7.1 The
BookandReviewentity classes show six of the terms used in this chapter to discuss relationships: principal entity, dependent entity, principal key, navigational property, foreign key, and required relationship. Not shown is the optional relationship, which is described in section 2.4.4.![]()
Figure 7.5 shows the three options for building this sort of one-to-one relationship. The principal entities are at the top of the diagram, and the dependent entities are at the bottom. Note that option 1 has the
Attendeeas the dependent entity, whereas options 2 and 3 have theTicketat the dependent entity.
Listing 7.7 Changing the default
OnDeleteaction on a dependent entitypublic static void Configure (this EntityTypeBuilder<LineItem> entity) { entity.HasOne(p => p.ChosenBook) .WithMany() .OnDelete(DeleteBehavior.Restrict); #1 } #1 Adds the OnDelete method onto the end of defining a relationship. Setting it to Restrict stops the LineItem from being deleted, hence EF Core will throw an exception if a Book entity class is deleted and a LineItem is linked to that specific book.