I have an editable grid bound to a Linq to SQL table. I use SubmitChanges to save changes and I need a way to get old values of the changed rows. I tried getting context.GetChangeSet().Updates but the problem is the rows in this collection has new values not the old ones, even before calling SubmitChanges(). How can I do this?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
The L2S cache will contain the old values. Even after you call SubmitChanges(). I found this out the hard way. The cache will contain the old values until you call context.Refresh() to refresh all the rows. So, you can simply re-retrieve the values. L2S will get them from cache, which will be the old values.
Randy