How can I reject all changes in a Linq to SQL's DataContext?

后端 未结 10 995
礼貌的吻别
礼貌的吻别 2020-11-27 18:57

On Linq to SQL\'s DataContext I am able to call SubmitChanges() to submit all changes.

What I want is to somehow reject all changes in the datacontext and rollback a

10条回答
  •  眼角桃花
    2020-11-27 19:24

    The Refresh will work, however you have to give the entities you want to reset.

    For example

    dataContext.Refresh(RefreshMode.OverwriteCurrentValues, someObject);
    

提交回复
热议问题