Page 1 of 1
TransactionScope Question
Posted: Mon 16 Aug 2010 18:54
by KW
I want to enlist the connection string used by the System.Web.Security.Membership class and a Devart mysql Connection and Command object.
Do I just use a transcation scope to do this?
For example,
using ( TransacitonScope scope = new TransactionScope)
{
System.Web.Security.Membership.CreateUser(NewCustomerEmail.Text, Password.Text, NewCustomerEmail.Text);
MySqlConnection con = new MySqlConnection("Constring");
MySqlCommand command = new MysqlCommand("UpdateInfo", con);
command.ExecuteNonquery();
}
In the above example, will they both enlist in the same transaction?
Re: TransactionScope Question
Posted: Mon 16 Aug 2010 19:49
by KW
with more research you find that the Membership.CreateUser uses its on local transaction.
So when you try to enlist it in a distributed transaction it throws an exception, that you can't enlist in a distributed transaction and a local transaction at the same time.
Is there a way around this?
Posted: Tue 17 Aug 2010 11:23
by Shalex
We recommend you using the
following overload of the System.Web.Security.Membership.CreateUser() method:
Code: Select all
System.Web.Security.MembershipCreateStatus status;
System.Web.Security.Membership.CreateUser("user", "pass!word", "[email protected]", "why?","because",true, out status);
if (status == System.Web.Security.MembershipCreateStatus.Success) {
try {
using (MySqlConnection con = new MySqlConnection("Constring")) {
MySqlCommand command = new MySqlCommand("UpdateInfo", con);
con.Open();
command.ExecuteNonQuery();
}
}
catch{
System.Web.Security.Membership.DeleteUser("user");
}
}
Posted: Tue 17 Aug 2010 17:22
by KW
ok, so basically there is no way to really enlist it in a transaction?
Thanks for the input.
Posted: Wed 18 Aug 2010 11:07
by Shalex
Internal implementation of Membership Provider creates its own local transaction, but local transactions cannot be enlisted to the distributed transaction. We will investigate the issue to check if it is possible to work around this situation.
Posted: Thu 19 Aug 2010 08:55
by Shalex
We have fixed bug with enlisting ASP.NET provider's activity to distributed transaction. I will post here when corresponding build is available for download.
Posted: Thu 19 Aug 2010 19:25
by KW
Shalex wrote:We have fixed bug with enlisting ASP.NET provider's activity to distributed transaction. I will post here when corresponding build is available for download.
Thanks.
Posted: Wed 22 Sep 2010 16:55
by KW
KW wrote:Shalex wrote:We have fixed bug with enlisting ASP.NET provider's activity to distributed transaction. I will post here when corresponding build is available for download.
Thanks.
Do you have a time frame to which this will be released? Thank you.
Posted: Fri 24 Sep 2010 14:37
by Shalex
New build of dotConnect for MySQL 5.80.170 is available for download now!
It can be downloaded from
http://www.devart.com/dotconnect/mysql/download.html (trial version) or from Registered Users' Area (for users with valid subscription only).
For more information, please refer to
http://www.devart.com/forums/viewtopic.php?t=19069 .