在使用scaffolded MVC Controller进行保存期间,我希望更改属性。
private myEntities db = new myEntities();
public ActionResult Edit()
if (ModelState.IsValid)
{
tblQuote quote = db.Quotes
.Include(a => a.Parts)
.SingleOrDefault(x => x.QuoteID == 4);
quote.Name = "NewName"
db.Entry(quote).State = EntityState.Modified;
db.SaveChanges();
}
我试图从这里使用GetModifiedProperties Getting all changes made to an object in the Entity Framework
var myObjectState=db.ObjectStateManager.GetObjectStateEntry(quote);
但VS告诉我db“不包含ObjectStateManager的定义”。如何从“quote”
获取更改的字段