I have a class for a many-to-many relationship, like so:
public partial class AdminBoundaryStaff
{
[Key, Column(Order=0)]
public int idAdminBoundary { get; set; }
[Key, Column(Order = 1)]
public int idAdminStaff { get; set; }
[Key, Column(Order = 2)]
public int idAdminStaffType { get; set; }
public virtual AdminBoundary AdminBoundary { get; set; }
public virtual AdminStaff AdminStaff { get; set; }
public virtual AdminStaffType AdminStaffType { get; set; }
If I change the value of the idAdminStaff and post the form back to the controller, EF doesn't seem to see that there has been a change and doesn't even attempt a SQL update (watching it with profiler).
[HttpPost]
public ActionResult Edit( AdminBoundaryStaff adminboundarystaff)
{
if (Mode开发者_JAVA百科lState.IsValid)
{
db.Entry(adminboundarystaff).State = EntityState.Modified;
db.SaveChanges();
return RedirectToAction("Index");
}}
精彩评论