I am not clear on whether I need to use TransactionScope or DbContext.SaveChanges() is enough to commit my transaction consisting of multiple CRUD operations. I am using SQL Server in the backend.
If you are calling SaveChanges()
multiple times, and want to roll back all of those changes, yes you would want to use a TransactionScope
. If you are calling SaveChanges()
once on the context, all your changes are pushed to the database at once in a transaction behind the scenes.
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