0

I am using the csharp-SQLite wrapper in my C# project.

Before, I used the same library but the syncro functions instead of the async.

I could use BeginTransaction. This function does not exist in the async calls.

How can I start and commit a transaction using async calls?

1 Answer 1

5

I have found it in Stackoverflow. The function is RunInTransactionAsync:

await MyDatabaseManager.Connection.RunInTransactionAsync((SQLiteConnection connection) =>
{
  foreach (Hotel _hotel in listUpdates)
  {
    result = connection.Update(_hotel);

    if (result == 0)
    {
      connection.Insert(_hotel);
    }
  }
});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.