C# Entity Framework Basics Extending Our Entity Data Model Using a One-to-Many Relationship

olu adesina
PRO
olu adesina
Pro Student 19,018 Points

why are we not creating a dbset property of type series in the context class ? entity framework

how does entity framework know about the other tables/enties without them being declared in the context class

1 Answer

Steven Parker
Steven Parker
176,605 Points

A DbSet for the Series isn't needed because the Series entity is not directly referenced through the context.

But it has a one-to-many relationship with ComicBook, which causes it to be included in the conceptual model when ComicBook is referenced on the context. This also causes it to be included in the storage model, and then to be created as a table.

Conceptual model creation is discussed in the Where's Our Data? video starting at about 4 minutes.