开发者

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

开发者 https://www.devze.com 2022-12-29 11:57 出处:网络
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 Wit

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

精彩评论

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