views:

39

answers:

1

Using the model-first approach, I made 2 entities: Project and User. A project has multiple Users (involved in the project), and a User has (access to) multiple Projects, so following along with the Tekpub video, I made the many-to-many navigation property using the primary keys of the two entities.

I made some test data, and the data is a-ok, however in ASP.NET MVC, when attempting to create a list of projects, with sub-lists of each project's users, the user lists are empty(they're initialized, though, ie. not null), and vice-versa (list of users, project sub-lists are empty).

So I suppose my question is, how do I debug how it's fetching those navigation properties and why they're returning nothing?

A: 

Thanks to another post, I needed to use the keyword "Include" in my query. So when trying to load a user and his associated projects, it was:

from o in Repository.Users.Include("Projects")
select o;

Rather than simply:

from o in Repository.Users
select o;

And non-linq would be Repository.Users.Include("Projects");

George R