Im trying to understand how to use a using statement in SQLite in order to avoids deadlocks and what not. Lets say I have this code in my repository:
public SQliteRepository(SQLiteAsyncConnection connection)
{
_connection = connection;
_connection.CreateTableAsync<User>();
}
public async void SaveUser(User user)
{
await _connection.InsertAsync(user);
}
I assume that I should wrap the SaveUser in a using-statement but the info I find usually deals with non-async code. Also, does this code mean that I open the connection in the CTOR and it stays open? Should I not assign the _connection at all in the CTOR?
Aucun commentaire:
Enregistrer un commentaire