SQLiteAsyncConnection UpdateWithChildren 不可用

SQLiteAsyncConnection UpdateWithChildren not available

我正在尝试使用 SQLite.net 在我的 PCL 中实现 OneToMany 关系。我有异步扩展包 (SQLiteNetExtensions.Async),我的代码基于 https://bitbucket.org/twincoders/sqlite-net-extensions 中的示例。我正在使用 SQLiteAsyncConnection,但 UpdateWithChildren 方法似乎不可用,只能使用 SQLiteConnection。

using SQLite.Net;
using SQLite.Net.Async;
using SQLite.Net.Interop;
using SQLiteNetExtensions.Extensions;

private readonly SQLiteAsyncConnection conn;
public ActivityRepository(ISQLitePlatform platform, string dbPath)
{
    var connectionFactory = new Func<SQLiteConnectionWithLock>(() => new SQLiteConnectionWithLock(platform, new SQLiteConnectionString(dbPath, storeDateTimeAsTicks: true)));
    conn = new SQLiteAsyncConnection(connectionFactory);
}
public void method(object object) {
    conn.UpdateWithChildren(object); --function not available
}

使用 SQLiteAsyncConnection 时,您必须使用 async Nuget packageSQLiteNetExtensionsAsync.Extensions 命名空间和所有方法的异步版本:

using SQLite.Net;
using SQLite.Net.Async;
using SQLite.Net.Interop;
using SQLiteNetExtensionsAsync.Extensions;

private readonly SQLiteAsyncConnection conn;
public ActivityRepository(ISQLitePlatform platform, string dbPath)
{
    var connectionFactory = new Func<SQLiteConnectionWithLock>(() => new SQLiteConnectionWithLock(platform, new SQLiteConnectionString(dbPath, storeDateTimeAsTicks: true)));
    conn = new SQLiteAsyncConnection(connectionFactory);
}
public Task method(object object) {
    return conn.UpdateWithChildrenAsync(object);
}

请注意所有异步方法 return a Task 必须等待或 returned。