ado.net

Using TransactionScope with Stored Procedure Transaction does not work

橙三吉。 提交于 2020-12-13 03:30:39
问题 As per my understanding, C# TransactionScope can still work when wrapping a T-SQL BEGIN / COMMIT TRANSACTION inside a stored procedure. I have the following C# method which does EF Save first, then call a stored procedure that has its own transaction and then call external service over HTTP public async Task DoSomething(MyDto dto) { using (var scope = new TransactionScope()) { //Save First var myEntity = await _dbContext.MyEntity.Where(x=>x.Id == dto.Id).SingleOtDefaultAsync(); // Assign