Entity Framework - Transactions replacing SaveChanges(bool) with SaveChanges(SaveOptions)

此生再无相见时 提交于 2019-12-22 04:21:09

问题


This is a follow up question to Using Transactions or SaveChanges(false) and AcceptAllChanges()?

Specifically about this line context2.SaveChanges(false);

Now SaveChanges(bool) is deprecated. We are supposed to use SaveChanges(SaveOptions) instead.

The SaveOptions has following options:

  • None
  • AcceptAllChangesAfterSave
  • DetectChangesBeforeSave

Which of these map to SaveChanges(false)?


回答1:


SaveChanges(SaveOptions.DetectChangesBeforeSave) is equivalent of SaveChanges(false)



来源:https://stackoverflow.com/questions/10404934/entity-framework-transactions-replacing-savechangesbool-with-savechangessav

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!