[Mono-list] Web Services asynchronously

Luciano _ lnc19 at hotmail.com
Wed Jun 11 10:46:08 EDT 2008


Hi:     I have a question about the Web Services, and how it works on mono.
 
I have a WebServices (running in apache with mod_mono) that use MySqlConnector to connect mysql server on the same machine. Within this WS i make some operations (Insert's and update's) in a transaction operation. 
I'm consuming this WS with a GtkSharp app, this app calls the WS asynchronously, with CallBack. My Question is, if the services is aborted in the middle of the transaction, the transaction will be rolled back? Or not? I test it, and i think yes, but i need to know if always be rolled back, or maybe sometimes no. My doubt is that maybe if the operation has terminated the transaction but the services is not finished and services is aborted, the services will be aborted but the transaction will be commited. Is the connection (i use a Using statement) correctly disposed?
 
The WS method (pseudo-code) will be like this:[WebMethod()]
public void TestAsync()
{
    using(MySqlConnection conn = new MySqlConnection("....ConnectionString..."))
    {
             conn.Open();
             MySqlTransaction myTran = conn.BeginTransaction();
 
             MySqlCommand cmd = new mySqlCommand();
             cmd.Transaction = myTran;
             cmd.CommandText = "INSERT INTO SOME TABLE;"
             cmd.ExecuteNonQuery();
 
             // If the abort call is in this moment, the transaction is rolled back? The connection is correctly disposed and closed?
 
             MySqlCommand cmd2 = new mySqlCommand();
             cmd2.Transaction = myTran;
             cmd2.CommandText = "UPDATE SOME TABLE;"
             cmd2.ExecuteNonQuery();
 
             // If the abort call is at this moment the transaction is rolled back?
             myTran.Commit();
          
             // If the abort call is at this moment the transaction is NOT rolled back?
             conn.Close();
    } 
   // The Using Statement is executing the Dispose method if i call Abort() ?
 
}
 
 
Thanks a lot in advanced, i will really appreciate help.
Luciano
_________________________________________________________________
Stop squinting -- view your photos on your TV.  Learn more.
http://www.microsoft.com/windows/digitallife/default.mspx?deepLink=photos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20080611/4dc9cd49/attachment-0001.html 


More information about the Mono-list mailing list