upgrading SQLite-net to SQLite.net - create SQLiteConnection

只愿长相守 提交于 2019-12-12 08:46:48

问题


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);

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


回答1:


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

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));


来源:https://stackoverflow.com/questions/30432644/upgrading-sqlite-net-to-sqlite-net-create-sqliteconnection

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!