Search code examples
.netasp.net-membershipsubsonic3transactionscopemsdtc

Transaction and ASP.NET Membership API


Hope someone of you have been there. I need to do some database stuff which involve multiple tables. I am using SubSonic 3 SimpleRepository to update/access records. Now in between calls to update tables I am calling System.Web.Security.Roles methods to do some lookup. I am using single repository object to do all the updates on DAOs, but when my code hits User.IsInRole("blahblah") it throws exception MSDTC is not available on the server.

I understand it is happening because SimpleRepository is using different connection and Membership API objects are using another connection.

Is there a way to get around it or do I have to wrap the Membership API objects in my own classes?


Solution

    • You can configure membership/roles provider(s) to use the connection string you need.

    • You can inherit from any of this provider(s) and wrap the call of each method with transaction scope, controlled from outside.