I have this very simple example:

This generates these straightforward classes:

However, when I access the property Cities of any of my User objects read from the database it is always set to null. I thought that the Entity Framework would fill that property. Am I right? What I’m doing wrong?
Thanks.
EDIT: Just as a note I’m using 3.5, not 4 (looks like there are some key differences)
By default, EF uses Lazy Loading, in order to avoid mapping a whole referential integrity graph (imagine you’ve had more tables under
Citiestable – it would then make the underlying SQL query extremely huge and contain a lot of JOINs).So you need to explicitly include subentities you want to be included and then a JOIN would occur behind the scenes. Call
.Include("Cities")after you query for Users (or whatever queried subset of it likeUsers.Where(...)).