Wrapping membership provider and dbcontext on single transaction

◇◆丶佛笑我妖孽 提交于 2019-12-05 14:15:59

Yes, Commit can certainly throw. One trivial example is if the connection drops. There are other cases, of course.

You have a few choices:

  • Transactions on the same DB won't escalate to distributed if the connection is shared. So you could use one connection for both EF and your WebSecurity connection.
  • Start the distributed transaction controller on the server and live with the escalation. Not the worst thing in the world.
  • Instead of using a transaction, change the order of operations such that a partially successful operation can be completed or undone later. E.g., detect and clean up "orphan" users.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!