I'm using ASP.NET MVC 4.5 with Entity Framework and everything I'm reading says my database context should be enclosed in a using statement to prevent memory leaks. However, when I pass my model to my view I lose the ability to join to other tables.
So if I have a model that has:
public class people
{
public int id { get; set; }
public sting name { get; set; }
public virtual stuff things { get; set; }
}
public class stuff
{
public int id { get; set; }
public string name { get; set; }
public int thingType { get; set; }
}
But if in my view I want to to loop add grab all of a persons's stuff I can't if I created my context in a using statement. What's the correct way to handle this?