我曾经在我的共享项目中打开我的SQLiteConnection
,如下所示:
var conn = new SQLiteConnection("MyDb.db3");
构造函数已更改为以下签名:
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);
我无法找到有关如何在我的共享库中实现此功能的任何示例/文档。
答案 0 :(得分:11)
一旦找到它就很容易。名称空间SQLite.Net.Platform
包含ISQLitePlatform
接口的实现。
我必须在特定于平台的库中实现它,而不是共享库。
new SQLiteConnection(new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(), Path.Combine(path, db));