How To Fix The Error 'The relationship 'x' was not loaded because the type 'x' is not available' In Entity Framework



TODO:

You are attempting to query a table, and you receive the message:  The relationship 'x' was not loaded because the type 'x' is not available.

 

SOLUTION:

Ensure your connection string is exists and is valid.  If you renamed your model be sure to change the .csdl and .ssdl entry in the connection string.  Once you correct the connection string, the error will go away.

 

NOTES:

There are no notes on this topic

Where Did Detach() Go In Entity Framework



TODO:

You are migrating old code to the latest version of Entity Framework, and you no longer have the Detach() method.  To fix, use the code below.

 

SOLUTION:

((IObjectContextAdapter)myModel).ObjectContext.Detach(myobject);

 

NOTES:

There are no notes on this topic.