【问题标题】:Setting Sqlite ThreadingMode when using sqlite-net + async使用 sqlite-net + async 时设置 Sqlite ThreadingMode
【发布时间】:2015-01-13 10:52:33
【问题描述】:

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

SqliteConnection.SetConfig(SQLiteConfig.Serialized);

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

有什么建议吗?

【问题讨论】:

    标签: c# sqlite xamarin sqlite-net


    【解决方案1】:

    好的,我必须将 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)));
        }
    

    【讨论】:

    猜你喜欢
    • 2015-01-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-01-26
    • 2012-11-14
    • 2016-06-02
    • 2012-04-15
    • 1970-01-01
    相关资源
    最近更新 更多