开发者

How to call Membership and Roles methods inside transaction?

开发者 https://www.devze.com 2023-03-06 12:18 出处:网络
I have a method which calls Membership.UpdateUser开发者_如何学编程() as well as some Roles methods along with some custom inserts, deletes of my own. Is it possible to do all this in a transaction? I

I have a method which calls Membership.UpdateUser开发者_如何学编程() as well as some Roles methods along with some custom inserts, deletes of my own. Is it possible to do all this in a transaction? I don't see any way to associate a transaction with the Membership or Roles providers. To clarify, I would like all operations to happen within the same transaction.


Place your updates within a TransactionScope scope:

using (TransactionScope trans = new TransactionScope([option]))
{
    Membership.Provider.UpdateUser(...);
    Membership.Provider.UpdateUser(...);
    trans.Complete();
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号