-1

In MVC core 2.2 we can use savechanges method after database actions(Insert/Delete/Edit). Now my question is:

Is there any way to roll back my actions after calling savechanges or is there any method to do it?

please guide me!!

Amir133
  • 2,372
  • 2
  • 18
  • 34
LPLN
  • 475
  • 1
  • 6
  • 20
  • 2
    I think there is 2 options for you: 1. Do not call SaveChanges() before you sure that you've done all the things right in your code. 2. Handle changes manually https://stackoverflow.com/questions/12859304/savechanges-vs-acceptallchanges-in-entity-framework – Liam Kernighan May 19 '19 at 10:37
  • 1
    This doesn't make much sense. What exactly is the issue/problem you are trying to solve? – William Xifaras May 19 '19 at 14:29
  • 1
    please See This Link: https://stackoverflow.com/questions/815586/using-transactions-or-savechangesfalse-and-acceptallchanges – Amin Golmahalleh May 31 '19 at 11:11
  • There's not enough information to answer this question without knowing what technology you're using for database access. I.e. Dapper, EF, ADO.NET, etc. – AaronLS Feb 03 '20 at 18:09

1 Answers1

1

you can do rollback with SqlTransaction.

alex
  • 322
  • 3
  • 7