views:

52

answers:

1

if i have 2 objectContexts for the same model each one hold some objects..

How can i find that object is attached to specific Object Context?

A: 

I have one solution by check the object With ObjectStateManager like this :

bool isPresent = objectStateManager.TryGetObjectStateEntry(((IEntityWithKey)order).EntityKey, out stateEntry);
if (isPresent)
{
    Console.WriteLine("The entity was found");
}

is this will work always fine?

Ahmed