1,062 questions
Best practices
2
votes
2
replies
65
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())
{
...
2
votes
1
answer
97
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
0
answers
69
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
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
votes
2
answers
237
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 ...
3
votes
1
answer
304
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 ...
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
745
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
...
1
vote
2
answers
2k
views
Azure Functions w/ EF Core DbContext - how does the DI scope work?
SOLVED: This error came from a table being locked through the open transaction and the other function call tried to wait for the unlock until it timed out.
I'm currently working on an Azure Function ...
2
votes
0
answers
225
views
Wrapping UserManager.Create in the same transaction as other Entity Framework operations
ASP.NET Core 7
EF Core 7
SQL Server
I have a routine that wants to perform multiple steps that involve calling DbContext.SaveChanges(). Thus, the routine wants to wrap all its work in a transaction. ...
0
votes
1
answer
102
views
Calling WCF method inside a Transaction cause error
I have a complex application and encountered an error. I simplified my real problem with the following code.
I have a WCF Service with a method that performs a select on one of my tables:
public ...
0
votes
2
answers
98
views
How to ensure rollback from without explicit ROLLBACK
If the ROLLBACK is out of scope because of the Catch block, assuming that is the cause, how am I supposed to resolve other than putting all the saves in a single method?
SqlConnection connection = new ...
0
votes
1
answer
411
views
A timeout exception occurred in C# LINQ due to an unexpected change in the isolation level from the default setting to Serializable
In my scenario, I have a method called GetEntries that invokes another method called Get within a transaction scope. Get method contains three LINQ queries. The first query retrieves a single ...
0
votes
1
answer
80
views
Distributed Transaction using TransactionScope
I have data which needs to be saved in two components (A, B).
Component C talks to B using WCF and talks to A using .Net Remoting.
Since C talks to B using WCF I am using TransactionScope (Issue in ...
1
vote
1
answer
207
views
Entity Framework 6 and Bulk Updating is Locking Table work arounds
I am calculating rankings for an entire 300 event season base off teams and games played. This means updating a ranking from oldest event to newest every night for ELO ratings.
We are using a ...
1
vote
1
answer
4k
views
Using transaction scope in C# returns "A root ambient transaction was completed before the nested transaction."
I am using the transaction scope from System.Transactions.
I have this method where I have two insertions in database. The first Localization is inserted, but then rolled back since it fails on the ...
1
vote
1
answer
705
views
TransactionTimeOut Exception on all DB hits made by a thread on which there was "A TransactionScope must be disposed on the same thread.." exception
In production all of the sudden we started to have Exception message was "A TransactionScope must be disposed on the same thread that it was created.". Looking into code it was clear we are ...
2
votes
0
answers
392
views
Kafka Transaction Scope in C#
Trying to persist some data in MongoDB and publish a couple of messages to Kafka everything inside of a transaction. I was thinking of using the dotnet TransactionScope but I do not see how to apply ...
3
votes
2
answers
1k
views
Design / Implement Transactional Outbox pattern in schema isolated multitenant application
I have a multi-tenant application. The tenants data is isolated based on schema.
I want to implement a transactional outbox pattern, where I want to store the events in a table (in same transaction)...
0
votes
1
answer
548
views
C# AOP Transaction Aspect
My problem is related to the undoing of the actions I have done when the error is received.
In the project that I am developing on .Net core 5, I can undo these transactions with Transection scope ...
0
votes
1
answer
1k
views
Bind Db context lifecycle to TransactionScope
I am new to Entity framework core but have used Nhibernate and Java Hibernate for years and I'd like to bind DbContext to transaction scope.
So method calls from service layer to business layers for a ...
1
vote
1
answer
3k
views
What is the difference between using a ServiceBusMessageBatch and sending multiple messages in a TransactionScope?
Using Azure.Messaging.ServiceBus.
I want to send multiple messages to Azure Service Bus in one transaction. I'm fine with the limit of 100 messages per transaction.
What are the pros and cons of these ...
2
votes
1
answer
3k
views
How to EnableRetryOnFailure inside Unit of Work TransactionScope?
Say I have the following UnitOfWork which can be injected into handlers and used to perform db operations within TransactionScope:
internal sealed class UnitOfWork : IUnitOfWork
{
private readonly ...
0
votes
0
answers
334
views
Transaction error when connecting to Oracle 19c with Oracle.ManagedDataAccess
When connecting to some databases, I get the following error message when opening a connection.
The caller is a TransactionScope.
From the app:
MTSRMManager.CCPEnlistDistributedTxnToSysTxn(...
0
votes
0
answers
774
views
"The Transaction has aborted" exception on disposing the Transaction Scope
The code shown here worked fine without any error on quality site, but the same code is causing an error
The Transaction has aborted
on the production site.
The error occurs on dispose of the scope. ...