How to call Membership and Roles methods inside transaction?
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();
}
精彩评论