Replace Entity Framework object
- by majkinetor
In MVC app, I am having this big object that is used in classic view/edit/create pattern.
When user edits the object I save it as:
public bool SetMyObject(MyObject newObject) {
MyObject current = GetObjectById(newObject.Id);
current.Prop1 = newObject.Prop1
...
current.PropN = newObject.PropN
db.SaveChanges();
}
MyObject is pretty big so I am wondering is there any better way to do this, not involving per-property assignments. For instance something along the lines db.MyObject.UpdateObject(current, tnew).
Ty.