Page 1 of 1
Where is "Enlist=false" conn string option?
Posted: Mon 28 Sep 2009 23:29
by tylerburd
I'm trying to set up a local db transaction within a System.Transactions.TransactionScope. I do not want this transaction to take part in the TransactionScope. With other DB drivers you can do this by specifying "Enlist=false" on the connection string. I cannot find any such feature in dotConnect for PostgreSQL. Am I missing something? Will this be added in a future build?
Thank you,
Tyler Burd
Posted: Tue 29 Sep 2009 10:21
by Shalex
The PgSqlConnection class includes the
EnlistTransaction method, which enlists the connection in the specified transaction.
Code: Select all
[C#]
public override void EnlistTransaction(
Transaction transaction
);
Parameters
transaction
A reference to an existing
System.Transactions.Transaction in which to enlist.
Remarks
Once a connection is explicitly enlisted in a distributed transaction, it cannot be unenlisted or enlisted in another transaction until the first transaction finishes.
Example
These samples demonstrate usage of EnlistTransaction.
Code: Select all
[C#]
pgSqlCommand1.Connection=pgSqlConnection1;
using (TransactionScope transScope = new TransactionScope()) {
pgSqlConnection1.Open();
pgSqlCommand1.ExecuteNonQuery();
transScope.Complete();
}
pgSqlConnection1.Close();
- or -
pgSqlCommand1.Connection=pgSqlConnection1;
pgSqlConnection1.Open();
using (TransactionScope transScope = new TransactionScope()) {
pgSqlConnection1.EnlistTransaction(Transaction.Current);
pgSqlCommand1.ExecuteNonQuery();
transScope.Complete();
}
pgSqlConnection1.Close();
- or -
CommittableTransaction cmtTx = new CommittableTransaction();
pgSqlConnection1.Open();
pgSqlConnection1.EnlistTransaction(cmtTx);
pgSqlCommand1.ExecuteNonQuery();
pgSqlConnection1.Close();
Posted: Tue 29 Sep 2009 18:18
by tylerburd
I understand that, but I would like to open a *new* connection and not enlist it in the TransactionScope at all.
var connectionThatShouldBeEnlisted = new PgsqlConnection(...);
var connectionNOTEnlisted = new PgsqlConnection(???);
using (TransactionScope transScope = new TransactionScope()) {
connectionThatShouldBeEnlisted.Open(); //want this one enlisted.
connectionNOTEnlisted.Open(); //I want this to NOT be enlisted.
...
transScope.Complete();
}
Posted: Wed 30 Sep 2009 15:46
by Shalex
We will implement the Enlist parameter of the connection string. I will post here when this functionality is available.
Posted: Thu 08 Oct 2009 11:54
by Shalex
The Enlist parameter is implemented. Look forward to the next build, which will be available in 2-3 weeks.
Posted: Tue 20 Oct 2009 09:24
by Shalex
The new build of dotConnect for PostgreSQL 4.55.49 is available for download now.
It can be downloaded from
http://www.devart.com/dotconnect/postgr ... nload.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=16153 .