I've enabled System.Transactions logging:
<system.diagnostics>
<sources>
<source name="System.Transactions" switchValue="Warning">
-- my listeners here
</source>
</sources>
</system.diagnostics>
and see A LOT of strange log warnings like:
Can please somebody shed some light on it? My system works as expected and there are no ADO.NET level exceptions raised. The DAL code is typical L2S code without explicit transaction management or any hacks.
LINQ to SQL supports transactions as a part of its architecture, and there are three types of transactions in LINQ to SQL. When you call SubmitChanges (), LINQ to SQL starts a local transaction by default and uses it to execute the generated SQL commands. When all SQL commands have been completed, LINQ to SQL commits the local transaction.
An exception is thrown if a different connection is used. You can call LINQ to SQL APIs in the scope of an active Transaction. LINQ to SQL detects that the call is within the scope of a transaction and does not create a new transaction. LINQ to SQL also avoids closing the connection in this case.
If you use LINQ to SQL explicit transactions against a single DataContext: You can use TransactionScope – it’s easiest and won’t escalate to DTC within a single DataContext You can also use explicit DataContext.Transaction to manually manage an ADO.NET transaction
For most ASP.NET developers, LINQ to SQL (also known as DLINQ) is an electrifying part of Language Integrated Query as this allows querying data in SQL server database by using usual LINQ expressions.
Using a switchValue of Warning will pickup more than just errors. From msdn:
A condition exists that can subsequently result in an error or critical failure (for example, allocation failing or approaching a limit). Normal processing of errors from user code (for example, transaction aborted, timeouts, authentication failed) can also generate a warning.
Maybe this is what you want. If so, cool. Otherwise, you may want to change it to Error.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With