Unable to open and close database

Oct 26, 2011 at 10:26 AM

Hello.

I'm trying to use your API for SQLite for metro application and have discovered that it does not support multithreading. (COM exception occuors)
A workaround was to open and than close database within same thread which worked if GC managed to collect database in time.

SQLite.

Database db = OpenDatabase();
// do stuff
db.Dispose();
GC.Collect();

 

However this method is very unreliable and unsebla in most of scenarios.
Is there a way to make it work with the new async/await keywords from .NET 4.5 in a reliable way?
Is there a way to delete a database?

Coordinator
Oct 28, 2011 at 4:08 PM

You should use using in C# (using (var db = ...)). This will call the destructor which will close the sqlite instance.