开发者

Check if object is in context entity framework

Is it possible to开发者_运维技巧 check that an object is in the context before trying to delete that from context ?

thanks for help


Yes, something like:

var key = myContext.CreateEntityKey("Table", myObject);

if (myContext.TryGetObjectByKey(key, out otherObject))
{
     // delete or edit otherObject
}

But you find in /delete from the database, not (just) the context.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜