Please Login to Continue

Andrew M. Greeley, A Midwinter's Tale

Andrew M. Greeley, A Midwinter's Tale

$10.00

Green Seating Bag

Green Seating Bag

$20.00

BIGBEN Connect

BIGBEN Connect

$1.00

Microsoft.EntityFrameworkCore.Database.Transaction[20205] An error occurred using a transaction.

Error when working with Entity Framework core: Microsoft.EntityFrameworkCore.Database.Transaction[20205] An error occurred using a transaction. System.Data.SqlClient.SqlException (0x80131904): The COMMIT TRANSACTION request has no corresponding BEGIN TRANSACTION. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) Answer: If you are saving your changes using _context.SaveChangesAsynch() then you need to change to _context.SaveChanges(). The reason why the errorr happens is because the transaction is run on Asynchronously. When you do _context.SaveChanges() or chain the function like: _context.[YourDataModel].Add([YourObject]).Context.SaveChanges(); The transaction happens in one commit and the Database connection does not close and reopen to save the changes.
Technology published

Was this page helpful?

Yes Yes! this solution to the problem was helpful. No No! this solution to the problem was not helpful..



© 2020 - ErnesTech - Privacy