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?
精彩评论