I am new to EF and I have the following query:
List<Test.MemberAccount> userAccounts = new List<Test.MemberAccount>();
using (var context = new CoopEntities1())
{
var query = from s in context.MemberAccount
join sa in context.AccountType on s.account_type_id equals sa.id
where s.member_guid == memberID
select s;
userAccounts = query.ToList();
}
return userAccounts;
Problem is when I load the page I get the following error:
"The ObjectContext instance has been disposed and can no longer be used for operations that require a connection."
Any help would be fantastic.
Error in detail:
AccountType = '((new System.Collections.Generic.Mscorlib_CollectionDebugView<Test.MemberAccount>
(userAccounts)).Items[0]).AccountType'
threw an exception of type 'System.ObjectDisposedException'