EF4.3 Code-First, MVC, Lazy Loading After Attaching in POST Action
问题 I'm using Entity Framework 4.3 with Code-First in an MVC 3 application. I have a POST action that gets an entity as its' parameter, and then marks the entity as modified to update the database. It's a Document entity that has a reference to a File Type. [HttpPost] public ActionResult Example(Document model) { // fileType is null, as expected var fileType = model.FileType; // attach and mark the entity as modified, save changes Context.Entry(model).State = EntityState.Modified; Context