4

How can I use classes from System.Transactions namespace to achieve similar effect as I can get when using SqlTransaction.Save(savePoint) and SqlTransaction.Rollback(savePoint). The effect of using these two methods is ability to create named save point in the running transaction and in case of issue rollback only to the save point (operations created before save point are not rolled back).

Ladislav Mrnka
  • 360,892
  • 59
  • 660
  • 670

2 Answers2

3

Save Points are database specific in part of their implementation. Oracle implements them, and apparently so does SQL server.

System.Transactions is designed for full-bore transactions, and not intermediate save points along the way of a transaction.

Alas, because it would be nice to have this feature in the lowest-common denominator database supported: ACCESS JET.

Andy Finkenstadt
  • 3,547
  • 1
  • 21
  • 25
2

yourcontext.Database.ExecuteSqlCommand(string.Concat("save transaction ", savePoint));

yourcontext.Database.ExecuteSqlCommand(string.Concat("rollback transaction ", savePoint));

Glayson
  • 31
  • 2