I am working on a .NET application using SQLite. According to SQLite documentation, it supports multithreading and can be used in one of the following 3 modes
- Single thread. In this mode, all mutexes are disabled, and SQLite is unsafe to use in more than one thread at a time.
- Multi-thread. In this mode, SQLite can be safely used by multiple threads, provided that one database connection is not used simultaneously in two or more threads.
- Serialized In serial mode, SQLite can be safely used across multiple threads without restriction.
In accordance with these modes, I am trying to use Serialized, where I use Single connection for several tasks. But I get an error like "The operation is invalid due to the current state of the object. "
I assume this is due to sharing a single connection between tasks. But according to Serialized mode, I should be able to exchange a connection without any explicit implementation of blocking or mutex.
Can someone explain to me how I can use Serialized mode in a .net application? Is a connection string required in a specific way?
Thank Advance