I want to create a user with a role in the same transaction but i have an issue with the implementation. In order to use the userStore in the transaction and have it not save the changes automatically and ignore my transaction i had to turn off AutoSaveChanges. This makes it so it will wait until i call save changes. This works fine but because the userstore now does not return the userId when i call manager.Create due to this being off I dont have an Id to pass into userManager.AddToRole. Is there any way to add the user i am trying to create to a role within the same transaction?
相关问题
- Carriage Return (ASCII chr 13) is missing from tex
- How to store image outside of the website's ro
- 'System.Threading.ThreadAbortException' in
- Request.PathInfo issues and XSS attacks
- How to dynamically load partial view Via jquery aj
相关文章
- asp.net HiddenField控件扩展问题
- asp.net HiddenField控件扩展问题
- Asp.Net网站无法写入错误日志,测试站点可以,正是站点不行
- asp.net mvc 重定向到vue hash字符串丢失
- FormsAuthenticationTicket expires too soon
- “Dynamic operations can only be performed in homog
- What is the best way to create a lock from a web a
- Add to htmlAttributes for custom ActionLink helper
If you start your transaction manually, then commit it, everything that was written to DB inside your transaction will be held inside your transaction. And you can rollback that if you want to.
Do something like that:
Hope this helps.