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 context
is your linq2sql datacontext and faculty
is the entity you want to refresh?
What about retrieving the object from the database, then changing the appropriate values, then submitting the update?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With