1,062 questions
Best practices
2 votes
2 replies
67 views
Should using TransactionScope be inside a try..catch or the other way around?
I am pondering whether the using TransactionScope should be within a try..catch or the other way around. Within try..catch try { using (var scope = new TransactionScope()) { ...
0 votes
0 answers
31 views
TransactionException after updating Spring.net from version 2.0.2 to 3.0.2
After updating Spring.net packages from 2.0.2 to 3.0.2, it looks like something changed in the behavior of the [Transaction] attribute Interceptor, and now I'm getting an exception: System....
2 votes
1 answer
98 views
TransactionScope lost on making TestInitialize async
For a project I'm working on, I'd like to insert testdata before every test and then rollback the transaction for the next test to start with a clean slate. The skeleton code below works fine for that:...
0 votes
1 answer
165 views
Rollback database changes made by application/API in .NET test automation
I am working on a large-scale .NET test automation project (over 2500 test cases) that interacts with an application API. My goal is to keep the database clean and isolated between test runs. Here's ...
0 votes
0 answers
71 views
Cannot enlist in the transaction because a local transaction is in progress on the connection. Finish local transaction and retry
I am trying to use TransactionScope to make my db context operations spread across different files run under one transaction, so all or none save should happen. The problem is it is giving me this ...
0 votes
0 answers
44 views
SET XACT_ABORT ON in multi-database scenario from .NET [duplicate]
Situation I have legacy .NET code in C# that needs to save a bunch of data with a transaction. This data is spread over multiple SQL Server databases. One database is connected directly with ...
0 votes
1 answer
68 views
how to handle Transaction scopes in Azure function and in calling API?
I have a Azure function, which calls some API endpoint for database update/insert and then will complete the message in the Queue.In case azure functions code fails after API success, I want to ...
1 vote
2 answers
144 views
Deadlock is occuring very frequently
I am getting frequent deadlock in my appliation because The application has 50 to 60 screens we used SQL views for list screens we are using mainly only 2 tables which stores all the data and it has ...
-1 votes
2 answers
238 views
Integration test error when run simultaneously tasks in transaction
I wrote an integration test to insert two documents with two threads simultaneously, after the test is completed, I expect none of the records inserted during the test exist in the database. I used ...
0 votes
1 answer
2k views
Using Entity Framework Core v8.0.8 DbContext and TransactionScope to read uncommitted from a table
I'm currently looking at upgrading a .NET project (standard moving to .NET 8) that uses Entity Framework (v6.4.4) to EF Core (v8.0.8). For the most part the experience has been painless but I have one ...
3 votes
1 answer
310 views
Is it possible to disable the enlistment to ambient transactions in Entity Framework Core 8 globally?
Short version We want to disable the automatic enlistment to ambient transactions (System.Transactions.TransactionScope) for a whole Entity Framework Core 8 DbContext. The DbContext should never get ...
0 votes
1 answer
206 views
How to log errors in DB within a transaction that fails with Entity Framework 6
If I'm in the middle of doing a bunch of updates within a transaction, and it throws an exception, I still want to log some information in a table in the same db context so I know what happened. I ...
1 vote
0 answers
89 views
Using TransactionScope that store to Azure SQL database, and calling HttpClient is not committing on update
In ASP.NET Core 6.0, I am trying to update an Azure SQL database, and as well call a REST API for an external service, and if the external service call fails, I want to rollback the update. My code is ...
0 votes
1 answer
746 views
TransactionScope "A root ambient transaction was completed before the nested transaction"
Here's my scenario: I have an extremely large table in Microsoft Access that I need to move to SQL Server. public async Task Sync() { using TransactionScope trans = new(TransactionScopeOption....
0 votes
1 answer
751 views
'TRANSACTION ISOLATION LEVEL is set to SNAPSHOT' error when using TransactionScope on Memory Optimised Table
In Memory disk setup on SQL Server with below up snapshot_isolation_state snapshot_isolation_state_desc is_read_committed_snapshot_on is_memory_optimized_elevate_to_snapshot_on ...