Use Include:
var users = from u in db.Users.Include("Areas")
where u.Name.StartsWith("F")
select u;
Also change this code:
if(users.Count() > 0) // executes query
{
var dto = users.First(); // executes it again
}
to:
var dto = users.FirstOrDefault(); // execute once
if (dto != null)
{
// ...
}
Craig Stuntz
2009-08-07 15:15:22