You can overcome this scenario by replacing:
using System.Data.Objects;
With:
using System.Data.Entity.Core.Objects;
using System.Data.Objects;
using System.Data.Entity.Core.Objects;
using (var db = new MyEntities()) { var Owner_ID = new ObjectParameter("Owner_ID", typeof(string)); var msgError = new ObjectParameter("msgError", typeof(string)); db.InsBeerClient(Owner_ID, msgError); return (msgError.Value ?? "").ToString(); }
using (var db = new EGAIS_RUEntities()) { db.Configuration.ValidateOnSaveEnabled = false; var _rec = new CONTRAGENT() { id = 1, status = 3 }; db.CONTRAGENTS.Attach(_rec); var entry = db.Entry(_rec); entry.Property(e => e.status).IsModified = true; db.SaveChanges(); }
db.Configuration.ValidateOnSaveEnabled = false;
dbcontext.Entry(_rec).State = System.Data.Entity.EntityState.Modified; dbcontext.SaveChanges();