Is there any attribute that one can put on a parameter for an action that tells LINQ to load a particular entity and only databind on the values that have changed a la Active Record/Monorail (see ARDataBinding)
+1
A:
You can use the TryUpdateModel and UpdateModel methods to update a model object with the values from a form collection like so:
public ActionResult Update(int id, FormCollection form)
{
Item myItem = _ItemRepository.Get(id);
TryUpdateModel(myItem, "Item", form);
// Processing
}
Is that the kind of thing you were after?
Edit: Note, I've had problems with this working when using the Entity Framework if you have strict referential integrity. But there are ways around it by specifying only to update the fields posted in the form, or to write your own model updater.
Odd
2009-01-28 05:28:17