2

What is the recommended way of using a SqliteConnection object?
We are using sqlite inside a console application and I'm wondering if we should use a single connection for the entire application lifetime or create a new connection each time we need to query the data.

What is the best practice here?

  • There is in reality no recommended way - use it according to your needs. Generally with SQLite, if it doesn't matter, I recommend keeping hold of the connection, it's thread safe. There's some trivial overhead with connecting. If it's a shared cache db then at least one connection has to always be open anyway, so... – bokibeg Aug 11 '21 at 14:32

0 Answers0