I have an application that requires transactions, this in itself is not a problem. I like using the TransactionScope class when i require a transaction because it helps keep my code readable. If i use the TransactionScope class when connecting to Sql Anywhere it forces me to use the DTC, if i use the BeginTransaction() method on the connection it works without the DTC. I would like to know if there is any means to use the TransactionScope class without enlisting the DTC. Note: I have one connection and two to three commands (in different parts of my code). |
Sadly, the answer to your question is no. .NET will happily avoid using DTC for transactions that involve only one data source if the data source supports LTM (the Lightweight Transaction Manager); but neither the SA client nor server have LTM support. Hence, .NET has no choice but to immediately promote the transaction to DTC. Karim |
FWIW more information on this general topic may be found in Avoid unwanted Escalation to Distributed Transactions and the related Q&As in stackoverflow.