1
SQLite.netを使用して自分のPCL内でOneToMany関係を実装しようとしています。私は非同期拡張パッケージ(SQLiteNetExtensions.Async)を持っており、https://bitbucket.org/twincoders/sqlite-net-extensionsにある例のコードをベースにしています。私はSQLiteAsyncConnectionを使用していますが、UpdateWithChildrenメソッドはSQLiteConnectionでしか使用できないようです。SQLiteAsyncConnection UpdateWithChildrenが利用できません
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);
}
すべての非同期メソッドを待つか、返却されなければならないTask
を返すことに注意してください:
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
}
ありがとう、非同期パッケージがインストールされていましたが、私はUpdateWithChildrenAsyncメソッドを使用していませんでした。 – Carl