当使用最新版本的System.Data.SQLite nuget包创建一个简单的SQLite事务时,我注意到SQLiteConnection.BeginTransaction()方法的intellisense描述包含"[deprecated]"并以单词OBSOLETE开头(全部大写,害怕!).但是,没有提到开始交易的新方法是什么.
我仍然可以调用该方法,并且在IDE中甚至没有警告,但有没有一种新的方法来完成我不知道的以下内容?
using (var conn = new SQLiteConnection(dbConnectionString))
{
conn.Open();
using (var trans = conn.BeginTransaction())
{
using (var cmd = new SQLiteCommand("some sql statement here", conn, trans))
{
cmd.ExecuteNonQuery();
}
trans.Commit();
}
}
Run Code Online (Sandbox Code Playgroud)
好吧,根据他们的源代码,只有param的重载bool deferredLock是过时的.您使用的方法不是:
资料来源:http://system.data.sqlite.org/index.html/artifact/5d691bfc46d3c324