I have a Xamarin Forms project that uses SQLite. I have a parent and child Model with the correct Foreign Key, ManyToOne and Cascading options on relevant fields.
I have been using Scott Hanselman's AsyncLock class (http://www.hanselman.com/blog/ComparingTwoTechniquesInNETAsynchronousCoordinationPrimitives.aspx) in my db methods like this:
public async Task<List<Client>> GetAllAsync()
{
List<Client> clients = new List<Client>();
using (await SQLiteBase.Mutex.LockAsync().ConfigureAwait(false))
{
//SQLiteAsyncConnection _connection is set up elsewhere...
clients = await _sqLiteBase._connection.Table<Client>().ToListAsync().ConfigureAwait(false);
}
return clients;
}
No problem so far. The issue I am facing, is that I cannot see cascading actions on this connection. I added a normal SQLiteConnection
, which had the -WithChildren
methods, but I need to use the SQLiteAsyncConnection
connection.
I have references to SQLite.Net, SQLiteNetExtensions, SQLite.Net.Async and SQLitePCL.raw.
Why can't I see the ~WithChildren
methods on the async connection object?
You have to add a SQLiteNetExtensions.Async package to your project https://www.nuget.org/packages/SQLiteNetExtensions.Async/