I'm using MVC 3 Razor (c#) and in my view I am displaying an entity where the user may only update the Name property.
public class Product{
public Guid Id {get; set; }
public string Name {get; set;}
public string Type {get; set;}
}
To prevent having the load the entire object from the database before saving it again, I use a method like:
public void UpdateProduct(Guid id, Hashtable propertiesToUpdate) {}
in a business object, to allow updating of a set of properties of the entity by either a AJAX request or a form Post. (Data constancy is done using timestamps).
I've looked at other methods like using INotifyPropertyChanged to update the property when the change is detected, but this seems only useful if you are able to keep the an instance between requests or loading the entire entity before making a change (which seems heavy).
I see NHibernate uses dynamic-update in a similar idea. Does this cause NHibernate to load the data from the database and do compares before generating the update statement?
Is there a best way of keeping the object being edited (Session[]?) between requests or a less clumsy way of updating individual properties (without moving to a Entity Attribute Value model)?