I am working with the Entity Framework 5 at the moment and try to build my first DB application. I do have 2 tables:
DataSet1 and DataSet2.
DataSet1 has a reference to DataSet2 and the code that gets build by the EntityFramework works in a way, that if I read DataSet1 from the DB, DataSet2 is already included as an object in DataSet1, not just the key (ID), but the whole object. Which is basically good, because I like to have the direct access to the object. So I do not need to get back to the DB to search for the right object.
While I do have access to DataSet1 all the time, it seems that I loose DataSet2 from time to time. I cannot say when or why, but sometimes I do have access to DataSet2 via the DataSet1 object and sometimes I get the Exception:
'(m.projectset).Client' threw an exception of type 'System.ObjectDisposedException'
Is there a rule, why I lose connection or how to avoid this?
how to deal with such relations, if one object contains another object instead of just the key of it?