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(); }
EntityFramework exec proc with out params
Entity Framework Update
You can easly do it by using this code
Please note, I set only value, that i wanted to cahnge. Another value is "id", that identifies the record.
Another interesting aspect is this
You will get an error if you don't set the fields with NOTNULL values.
another approach to it is
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(); }
Please note, I set only value, that i wanted to cahnge. Another value is "id", that identifies the record.
Another interesting aspect is this
db.Configuration.ValidateOnSaveEnabled = false;
You will get an error if you don't set the fields with NOTNULL values.
another approach to it is
dbcontext.Entry(_rec).State = System.Data.Entity.EntityState.Modified; dbcontext.SaveChanges();
Subscribe to:
Posts (Atom)