开发者

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

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?


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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜