DataContext.Refresh() would return some value telling at least if the instance was retrieved or was deleted in the database.
Today, if the instance was deleted from DB, Refresh throws any of two exceptions (InvalidOperationException or (less frequently) NullReferenceException). The code to cope with that is useless long (and repetitive).because one must catch two exceptions.
What if Refresh simply returns a "RefreshResult" enum value with no more than two values
RefreshResult.Retrieved
RefreshResult.Deleted
To get the second result, the exceptions would be processed internally to DataContext code, saving us from doing it once and again.
1
vote
-marcelo-
shared this idea