将SQLite-net升级到SQLite.net - 创建SQLiteConnection [英] upgrading SQLite-net to SQLite.net - create SQLiteConnection

查看:590
本文介绍了将SQLite-net升级到SQLite.net - 创建SQLiteConnection的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用来在我的共享项目中打开我的 SQLiteConnection ,如下所示:

I used to open my SQLiteConnection in my shared project as following:

var conn = new SQLiteConnection("MyDb.db3");

构造函数已更改为以下签名:

The constructor has been changed to the following signature:

    public SQLiteConnection(ISQLitePlatform sqlitePlatform, string databasePath, bool storeDateTimeAsTicks = true, IBlobSerializer serializer = null, IDictionary<string, TableMapping> tableMappings = null, IDictionary<Type, string> extraTypeMappings = null, IContractResolver resolver = null);
    public SQLiteConnection(ISQLitePlatform sqlitePlatform, string databasePath, SQLiteOpenFlags openFlags, bool storeDateTimeAsTicks = true, IBlobSerializer serializer = null, IDictionary<string, TableMapping> tableMappings = null, IDictionary<Type, string> extraTypeMappings = null, IContractResolver resolver = null);

我无法在共享库中找到任何有关如何实现此功能的示例/文档。 / p>

I was not able to find any examples/documentation on how to implement this in my shared library.

推荐答案

一旦发现它就很容易。命名空间 SQLite.Net.Platform 包含 ISQLitePlatform 接口的实现。

Quite easy once you found it. The namespace SQLite.Net.Platform containt the implementation for the ISQLitePlatforminterface.

我必须在de平台特定的库中实现这个,而不是共享的。

I had to implement this in de platform specific libraries instead of the shared one.

new SQLiteConnection(new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(), Path.Combine(path, db));

这篇关于将SQLite-net升级到SQLite.net - 创建SQLiteConnection的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆