In Linq To Sql, when updating one of my entities, Faculty, I am creating a new instance of the Faculty object, then initializing some of the properties with values supplied by the user.
If I attach this new object to the entity set, and submit changes, the properties that I didn’t set take on the default value of whatever datatype they are.
How can I refresh the new object so that the properties that have been set keep their values and the properties that haven’t been set get the values from the database?
Thanks
Did you try
context.Refresh(RefreshMode.OverwriteCurrentValues, faculty);after submit changes where
contextis your linq2sql datacontext andfacultyis the entity you want to refresh?