A: 

You need to tell the entity framework to load the Users for the Calendar.

You can do this VIA the LINQ query, simply:

Calendar cal = (from c in Calendar
    where c.CalendarID.Equals(input)
    select new 
    {
        c,
        c.Users
    }).FirstOrDefault().c;

Which says, load the calendar and all its users.

EDIT: There are probably other ways to load the users, this is just the LINQ way.

Odd
Hi thanks for the advice, I've been playing with the code you posted and it works fine for returning one record. If however I change FirstOfDefault to ToList it just says cant convert annonymous type to Generic.List<GameCalendar>. Am I going about returning a list in the wrong way?Thanks again
Gavin Draper
That's right because you're returning a list of many objects. Try this:var data = (from c in Calendar where c.CalendarID.Equals(input) select new { c, c.Users }And inspect data to see what the data structure looks like.
Odd
+1  A: 

for anyone interested I solved this by using the following code

        UnityGamersEntities db2 = new UnityGamersEntities();
        ObjectQuery<GameCalendar> gc = db2.GameCalendar.Include("GameTitles");

There seems to be a real lack of tutorials for the entity framework, unless you only ever want to work with single tables I found it really hard to find the information I need.

hopefully this will change in coming months.

Gavin Draper
Yes, this annoys me completely I'd moved to EF from L2S due to it's better support of lookup tables, and then found that I lost my strong typing, due to having to declare all sub tables in strings.
Zhaph - Ben Duguid
+1  A: 

Gav,

There is another way you can get Linq to Entities to populate the Users Table.

Every Foreign Key and Collection has a "Load" Method on it which will go off to the database and, in your case, fetch the list of users linked to the current calendar and populate the collection. It's kind of like lazy loading.

If you were to add this line it should work:

<!-- Load up Users unless it's already Loaded -->
<% if(!calendarEntry.Users.IsLoaded) calendarEntry.Users.Load(); %>

<!-- Your Line -->
<%= calendarEntry.Users.Username%> : <%= calendarEntry.DataAdded %>

Hope it helps.

PS - I hear you on the lack of documenation

Crafty

CraftyFella