gpt4 book ai didi

c# - 使用 sqlite-net + async 时设置 Sqlite ThreadingMode

转载 作者:行者123 更新时间:2023-12-03 17:39:48 26 4
gpt4 key购买 nike

我正在尝试在我的 Xamarin.iOS 项目中将 Sqlite ThreadMode 设置为序列化。使用经典的 Sqlite,可以在连接类上找到此方法:

SqliteConnection.SetConfig(SQLiteConfig.Serialized);

但是我正在使用 sqlite-net (+异步)并且找不到设置此配置属性的方法。

有什么建议吗?

最佳答案

好吧,我必须将 SQLite-Net(和 SQLite-Net-PCL 等)更新到 2.5。

然后可以通过平台特定的实现来访问此选项:

public Repository(IPlatform platform)
{
_platform = platform;
_platform.SqlitePlatform.SQLiteApi.Config(ConfigOption.Serialized);

_db = new SQLiteAsyncConnection(() =>
new SQLite.Net.SQLiteConnectionWithLock(
_platform.SqlitePlatform,
new SQLite.Net.SQLiteConnectionString(_platform.DatabasePath, true)));
}

关于c# - 使用 sqlite-net + async 时设置 Sqlite ThreadingMode,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27920429/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com