sqlite:SQLiteTransaction和SQLiteTransaction2之间有什么区别

问题描述 投票:0回答:1

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

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

.net sqlite
1个回答
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);
}
© www.soinside.com 2019 - 2024. All rights reserved.