开发者

entity framework mark as modified code first 5

Marking a property as modified should be done like this:

using (var context = new UnicornsContext())
{
    var unicorn = context.Unicorns.Find(1);
    var nameIsModified1 = context.Entry(unicorn).Property(u => u.Name).IsModified;

    // Use a string for the property name
    var nameIsModified2 = context.Entry(unicorn).Property("Na开发者_如何学运维me").IsModified;
}

code sample from here

In my code UnicornsContext extends DBContext.

I don't have a Entry method for my context. whats's wrong?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜