[英]Transaction for ASP .net Membership
I would like to make two database operation in one transaction. 我想在一个事务中进行两个数据库操作。 Those two operations are
这两项行动是
I tried TransactionScope but it went to distributed transaction at that line: -- Membership.CreateUser("test", "password", "test@test.com"); 我尝试了TransactionScope,但它在那一行进入了分布式事务: - Membership.CreateUser(“test”,“password”,“test @ test.com”);
How can I do this with lightweight transaction since I have only DB? 我怎么能用轻量级事务做这个,因为我只有DB?
Thanks in advance. 提前致谢。
The current implementation of TransactionScope will only use a lightweight transaction if you use a single database connection. 如果您使用单个数据库连接,则TransactionScope的当前实现将仅使用轻量级事务。 So it is not possible to achieve this in your scenario.
因此,在您的方案中无法实现此目的。
I have a similar problem. 我有一个类似的问题。 My resolution is (I'm still not sure its going to work) to download the ASP.Net Membership Provider code and rebuild it, hijacking the SqlConnectionHolder class.
我的决议是(我仍然不确定它会起作用)下载ASP.Net成员资格提供程序代码并重建它,劫持SqlConnectionHolder类。
I was looking for this topic and I think I have found an answer. 我正在寻找这个话题,我想我找到了答案。 It only applies to SQLServer 2008. It does not require changes to System.Transactions namespace or our Application code.
它仅适用于SQLServer 2008.它不需要更改System.Transactions命名空间或我们的应用程序代码。 It's interesting.
这真有趣。 ;)
;)
http://blogs.msdn.com/b/adonet/archive/2008/03/26/extending-lightweight-transactions-in-sqlclient.aspx http://blogs.msdn.com/b/adonet/archive/2008/03/26/extending-lightweight-transactions-in-sqlclient.aspx
Hope this helps! 希望这可以帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.