Yes, that explains a lot. When IEnlistmentNotification is implemented the
provider supports the two-phase commit protocol ie. commit or rollback. What
happens in .NET 2.0 is that an Lightweight Transaction Manager (LTM)
monitors the transaction and promotes the transaction if the transaction
starts to span more than 1 connection. IE. you can fire as many transaction
queries you want and have the ability to rollback or commit on all of them
together if you are using the same connection. But if you want to open more
than one connection, eg. transactions involving more than one firebird db
(even different datasources like Oracle, webservice call etc.) the
transaction is promoted to the Distributed Transaction Coordinator (DTC)
which manage all the transactions. Note that DTC management only works on
providers which implements IPromotableSinglePhaseNotification and that a
transaction can run in ADO.NET where this interface is not needed (there is
only one connection used in an ADO.NET transaction).
Let me illustrate the syntax for TransactionScope (LTM or DTC) and
DbTransaction (ADO.NET) - the latter first.
C# DbTransaction (ADO.NET)
...
using (FbConnection cn = new FbConnection)
{
 cn.ConnectionString = [theConnectionString];
 cn.Open();
 using (FbTransaction tran = cn.BeginTransaction())
 {
   using (FbCommand cmd = cn.CreateCommand())
   {
     cmd.Transaction = tran;
     cmd.CommandText = [SQLStatement];
     // Excecute SQL statement and do whatever
   }
   // if we made it this far, commit
   tran.Commit();
 }
}
...

C# TransactionScope (LTM )
...
using (TransactionScope ts = new TransactionScope)
{
 using (FbConnection cn = new FbConnection)
 {
   cn.ConnectionString = [theConnectionString];
   cn.Open();
   using (FbCommand cmd = cn.CreateCommand())
   {
     cmd.CommandText = [SQLStatement];
     // Excecute SQL statement and do whatever
   }
   // if we made it this far, commit
   ts.Complete();
 }
}
...
C# TransactionScope (DTC)
...
using (TransactionScope ts = new TransactionScope)
{
 using (FbConnection cn = new FbConnection)
 {
   cn.ConnectionString = [theConnectionString];
   cn.Open();
   using (FbCommand cmd = cn.CreateCommand())
   {
     cmd.CommandText = [SQLStatement];
     // Excecute SQL statement and do whatever
   }
 }
 using (FbConnection cn = new FbConnection)
 {
   cn.ConnectionString = [anotherConnectionString];
   cn.Open();
   using (FbCommand cmd = cn.CreateCommand())
   {
     cmd.CommandText = [SQLStatement];
     // Excecute SQL statement and do whatever
   }
 }
 // if we made it this far, commit
 ts.Complete();
}
...
In order to get DTC to work it has to be enabled on the database server (eg.
the server that host the Firebird db has to be an Windows machine). I have
made a Data Access Layer (DAL) that loads providers on application start and
can serve every database that has a .NET datasource provider. In my current
project I only need to support transaction to a single Firebird db but I
think it would be a neat feature to have in the Firebird .NET provider
(especially the ability to use transaction scope for multiple Firebird
databases in big projects).
There is really a lot of new possibilities in using TransactionScope but I
figure that too much to post in a forum ;-)
What do you guys think? Could it be implemented? I would like to help but I
don't want to fork the project :-)

On 3/14/07, Jiri Cincura <[EMAIL PROTECTED]> wrote:

Jon Ege Ronnenberg wrote:
> servers. Can anyone please tell me if the firebird provider (v. 2.0.1.0
> <http://2.0.1.0>) support IPromotableSinglePhaseNotification or which

No.

Provider has implementetation for IEnlistmentNotification (but I don't
know if this info helps you).

--
Jiri {x2} Cincura
http://blog.vyvojar.cz/jirka/ | http://www.ID3renamer.com

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share
your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to