You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow configuring SQLite synchronous mode in the connection string #38769
PRAGMA synchronous is scoped to a native SQLite connection and is not persisted in the database. Applications that require a specific mode, such as NORMAL for a WAL database, must execute the PRAGMA for every physical connection.
Microsoft.Data.Sqlite pooling makes this awkward. After SqliteConnection.Open(), an application cannot tell whether Microsoft.Data.Sqlite created a new native connection or leased an already-configured one from the pool. The reliable application-level workaround is therefore to execute the PRAGMA after every logical open:
This adds boilerplate and an extra command to every open. It is also easy for one connection-opening path to omit the configuration.
The connection string already supports analogous connection-scoped configuration such as Foreign Keys=True. Microsoft.Data.Sqlite reapplies that setting when a connection is opened, including when a physical connection is obtained from the pool.
This request is narrower than #5024, which was redirected to general EF lifecycle interception, and #13826, which addressed preserving configuration when reopening the same SqliteConnection. Neither provides a connection-string option that consistently configures all physical connections in a Microsoft.Data.Sqlite pool.
Observed with Microsoft.Data.Sqlite.Core 10.0.10.
Describe the solution you'd like
Add a Synchronous connection-string keyword and corresponding strongly typed SqliteConnectionStringBuilder.Synchronous property, for example:
When specified, Microsoft.Data.Sqlite would apply PRAGMA synchronous after obtaining the native connection during Open(), similar to the existing Foreign Keys behavior. When omitted, the provider would preserve SQLite's default behavior.
Including the value in the connection string would also naturally partition pools whose connections require different synchronous modes.
I’d like to work on this issue. My plan is to add a Synchronous option to SqliteConnectionStringBuilder, introduce a SqliteSynchronousMode enum for Off/Normal/Full/Extra, apply the corresponding PRAGMA synchronous when the connection is opened, and add builder and connection-level tests. Is this approach acceptable?
Activity
AhmedSadek10 commentedon Aug 13, 2026
I’d like to work on this issue. My plan is to add a Synchronous option to SqliteConnectionStringBuilder, introduce a SqliteSynchronousMode enum for Off/Normal/Full/Extra, apply the corresponding PRAGMA synchronous when the connection is opened, and add builder and connection-level tests. Is this approach acceptable?
@JamesNK
AndriySvyryd commentedon Aug 14, 2026
@AhmedSadek10 Sounds good, make sure it's only called once when reopening a pooled connection.
This feature is related to #29186
Add SQLite synchronous connection string option (dotnet#38812)
Add SQLite synchronous connection string option (#38812)