SQLite is not asynchronous, and the exposed Microsoft.Data.Sqlite ADO.net *Async
methods are implemented synchronously under the hood.
My question: how would you use SQLite in a asp.net core 5 API project which could benefit from asynchronous code, and also the async/await keywords to coordinate it?
I see two options
- use the "fake"
*Async
methods, and lose the benefits of asynchronous code for the code parts that touch the db. If I understand correctly, in .net core blocking a thread will not lead to deadlocks (https://blog.stephencleary.com/2017/03/aspnetcore-synchronization-context.html). If I understand correctly that would act like synchronous code executing on a thread pool thread, with the added overhead of the async/await machinery. - write synchronous code only, and lose the benefits for parts of the code
Which one do you think would be better?
Thanks!