I found that people use SQLiteConnection in Xamarin apps (iOS and Android) differently:
- Some people argue to use a single SQLiteConnection per application. It's created once and never disposed. Is it ok? Can it corrupt the DB file?
- Others use a single connection for each usage (like ADO.NET recommended practice) and dispose the connection right after it's used. Do we have some overhead here?
What is the right way to use SQLiteConnection in Xamarin apps?
There is also no single answer on how to use that SQLiteConnection from multiple threads. For example, using the second approach may cause "database is locked" exceptions. How to prevent it?
How to handle using a single database from multiple threads in general?
Aucun commentaire:
Enregistrer un commentaire