Example Code:
private static list;
public void SetList ()
{
var query = Container.Advices.Where ();
list= query.ToList();
}
public void doStuff ()
{
var temp= list.where (...).ToList ();
}
problem situation:
When i call the first time SetList, all worked fine. Now, a second is SetList called. I can see in the method, there are all objects, but in the second method doStuff is an exception thrown: ObjectContext is disposed ... I'm not understanding why. I saw the data is loaded correctly in the list and not a second later i can ' t load the navigation properties.
How can i fix this?
EDIT
What i do: 1. I call SetList() to initialize the list First time 2. doStuff all worked fine 3. I recreate the list with SetList 4. Next call to doStuff ended in exception on the try to use navigation properties:
var temp = list.where ( m=> m.Address.id==addressId).ToList ()
Failed on the second time with exception: ObjectContext is disposed. ..