I have list of delete queries & I execute them with this code:
using (var ctx = new ApplicationDbContext(schemaName))
{
foreach (var item in queries)
{
ctx.Database.ExecuteSqlCommand(item);
}
}
I want to commit all the delete queries, but I want to roll back if there is some error in any of the queries.
How to do roll back in the above scenario?