Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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

olu adesina
olu adesina
23,007 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
231,248 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.