Async limitations

SQLite doesn't support asynchronous I/O. Async ADO.NET methods will execute synchronously in Microsoft.Data.Sqlite. Avoid calling them.

Instead, use a shared cache and write-ahead logging to improve performance and concurrency.

var connection = new SqliteConnection("Data Source=AsyncSample.db;Cache=Shared");
connection.Open();

// Enable write-ahead logging
var walCommand = connection.CreateCommand();
walCommand.CommandText =
@"
    PRAGMA journal_mode = 'wal'
";
walCommand.ExecuteNonQuery();

Tip

Write-ahead logging is enabled by default on databases created using Entity Framework Core.