Hello,
I'm trying to use System.Transactions combined w/ Entlib 2.0 and get a strange behaviour.
My code looks something like this:
void Foo(){
...
using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required))
{
// Create DB
sngDatabase = DatabaseFactory.CreateDatabase();
using (SqlConnection connection = sngDatabase.CreateConnection() as SqlConnection)
{
//Open the connection
connection.Open();
using (new Tracer(LoggingCategory.Trace))
{
// Call the DAL, to save the changes to the database
SaveDataSet(runDefinitionDS);
}
}
...
The problem is, that when I get to the using (new Tracer(LoggingCategory.Trace)) line, the Transaction.Current transaction is aborted, and then all I try to do in SaveDataSet method on the transaction result in an exception.
Any explanation for this behaviour Any solution (beside using regular SqlTransaction)
Thanks,
Busi
.NET Development23
|