How to use SQLiteAsyncConnection from the async PCL version of SQLite?

后端 未结 2 1855
执念已碎
执念已碎 2021-02-07 13:27

I\'m using a PCL version of Sqlite.net from https://github.com/oysteinkrog/SQLite.Net-PCL

However, I\'m unable to get the DB connection setup. The SQliteAsyncConne

2条回答
  •  终归单人心
    2021-02-07 14:32

    You just need to create a function that returns a SQLiteConnectionWithLock and pass that to the SQLiteAsyncConnection constructor.

    string databasePath = "path";
    var connectionFactory = new Func(()=>new SQLiteConnectionWithLock(new SQLitePlatformWinRT(), new SQLiteConnectionString(databasePath, storeDateTimeAsTicks: false)));
    var asyncConnection = new SQLiteAsyncConnection(connectionFactory);
    

提交回复
热议问题