sqlite:SQLiteTransaction和SQLiteTransaction2之间的区别是什么

时间:2017-12-27 10:16:57

标签: .net sqlite

System.Data.SQLite有两个不同的事务类:SQLiteTransaction和SQLiteTransaction2

有人知道SQLiteTransaction和SQLiteTransaction2之间的区别吗?

1 个答案:

答案 0 :(得分:2)

SQLiteTransaction2支持嵌套事务,而SQLiteTransaction则不支持。

查看嵌入式类文档:

//
// Summary:
//     SQLite implementation of DbTransaction that does support nested transactions.
public sealed class SQLiteTransaction2 : SQLiteTransaction
{
    //
    // Summary:
    //     Commits the current transaction.
    public override void Commit();
    //
    // Summary:
    //     Attempts to start a transaction. An exception will be thrown if the transaction
    //     cannot be started for any reason.
    //
    // Parameters:
    //   deferredLock:
    //     TRUE to defer the writelock, or FALSE to lock immediately
    protected override void Begin(bool deferredLock);
    //
    // Summary:
    //     Disposes the transaction. If it is currently active, any changes are rolled back.
    protected override void Dispose(bool disposing);
    //
    // Summary:
    //     Issue a ROLLBACK command against the database connection, optionally re-throwing
    //     any caught exception.
    //
    // Parameters:
    //   throwError:
    //     Non-zero to re-throw caught exceptions.
    protected override void IssueRollback(bool throwError);
}