开发者

Alternative to Save point when using System.Transactions

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 po开发者_StackOverflowint in the running transaction and in case of issue rollback only to the save point (operations created before save point are not rolled back).


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.


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

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜