ARGH !!!
There seems to be a bit of confusion around the SharedDbConnectionScope and TransactionScope objects, allowing you to wrap your SubSonic requests in a transaction.
The docs suggest specifying the use of SharedDbConnectionScope wrapped around using TransactionScope ...
using(SharedDbConnectionScope scope = new SharedDbConnectionScope())
{
using(TransactionScope ts = new TransactionScope())
{
ts.Complete();
}
}
Then another question, for example, Subsonic: using SharedDbConnectionScope together with TransactionScope seems to be broken , suppose the documents are wrong, and two objects should be the other way around ...
using(TransactionScope ts = new TransactionScope())
{
using(SharedDbConnectionScope scope = new SharedDbConnectionScope())
{
ts.Complete();
}
}
But looking into the source code, I am even more confused.
In the SqlQuery.cs code file, it has several ExecuteTransaction overloads. For example...
public static void ExecuteTransaction(List<SqlQuery> queries)
{
using(SharedDbConnectionScope scope = new SharedDbConnectionScope())
{
using(TransactionScope ts = new TransactionScope())
{
foreach(SqlQuery q in queries)
q.Execute();
}
}
}
... ... , ... ts.Complete()?
? , . ExecuteTransaction!
...
TransactionWithDtcOffTests.cs , , SharedDbConnectionScope TransactionScope -!
using(TransactionScope ts = new TransactionScope())
{
using(SharedDbConnectionScope connScope = new SharedDbConnectionScope())
{
}
}
SubSonic 2.2, , - .
-...
- , SubSonic2.2? ? ExecuteTransaction , ?