The underlying, native SQLite connections are now pooled by default. This greatly improves the performance of opening and closing connections. This is especially noticeable in scenarios where opening the underlying connection is expensive as is the case when using encryption or in scenarios where there are lots of short-lived connections to the database. The Orchard Core benchmarks went from 5.5K to 14.5K requests per second with the latest version of Microsoft.Data.Sqlite.
Beware, however, that the database file may still be locked after you close a connection. If this becomes a problem, you can manually clear the pool to release the lock:
SqliteConnection.ClearPool(connection); // or SqliteConnection.ClearAllPools();
If you run into any issues, you can turn off connection pooling by specifying
Pooling=False in your connection string. Please be sure to file an issue too!
This release implements the ADO.NET Savepoints API. Savepoints enable nested transactions. For more information and a sample, see the new Savepoints section in the docs.
DateOnly & TimeOnly
The little things
Here are a few more minor changes also worth mentioning:
- Added the
Command Timeoutconnection string keyword as part of an effort to standardize it across providers
- Implemented the
Spanoverloads of SqliteBlob to avoid allocations
- Removed other unnecessary allocations and conversions between UTF-8 to further improve performance
Happy coding! Don’t forget to vote on the issues you’d like to see implemented in a future release.