I have been adding partial classes of my different entities to add various useful methods without issue.
Attempting to add properties appears to be straightforward based on examples that I've seen, but mine are failing miserably.
Updated example:
public List<Friend> FriendsInGoodStanding
{
get
{
using (var context = new GarbageEntities())
{
var a = context.Friends.Include("aspnet_User1").Where(f => f.UserID == this.UserId && f.Blocked == false).ToList();
var b = context.Friends.Include("aspnet_User").Where(f => f.FriendUserID == this.UserId && f.Blocked == false).ToList();
a.AddRange(b);
return a.Distinct().ToList();
}
}
}
I am receiving the following error any time I attempt to make use of this property:
The ObjectContext instance has been disposed and can no longer be used for operations that require a connection.
Line 4936: get
Line 4937: {
Line 4938: return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<aspnet_User>("GarbageModel.FK_Friends_aspnet_Users", "aspnet_User").Value;
Line 4939: }
This must be something obvious that I've overlooked.