Say I have a device entity that has many fields, and some navigational properties. When the user clicks edit for a particular device, we only want them to be able to edit some of those properties. Which implementation is recommended? (Is there a standard way of doing this)
Have hidden fields for all the properties of the device in the view, and even large hidden lists for the many relational navigation properties it may have. When the edit is posted, save all the changes to the entity using SaveChanges() - so that means let EF figure out what changed. (I'm not even sure MVC will be able to model bind the navigational prop's without some customization.)
Have a separate model, like
EditDeviceModel
that only has the properties that you would like to edit, and write a method for saving this model specifically to update the entity.Option I didn't think of???