Sphere10.Framework.Windows.Forms.Sqlite 3.1.2

dotnet add package Sphere10.Framework.Windows.Forms.Sqlite --version 3.1.2
                    
NuGet\Install-Package Sphere10.Framework.Windows.Forms.Sqlite -Version 3.1.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Sphere10.Framework.Windows.Forms.Sqlite" Version="3.1.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Sphere10.Framework.Windows.Forms.Sqlite" Version="3.1.2" />
                    
Directory.Packages.props
<PackageReference Include="Sphere10.Framework.Windows.Forms.Sqlite" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Sphere10.Framework.Windows.Forms.Sqlite --version 3.1.2
                    
#r "nuget: Sphere10.Framework.Windows.Forms.Sqlite, 3.1.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Sphere10.Framework.Windows.Forms.Sqlite@3.1.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Sphere10.Framework.Windows.Forms.Sqlite&version=3.1.2
                    
Install as a Cake Addin
#tool nuget:?package=Sphere10.Framework.Windows.Forms.Sqlite&version=3.1.2
                    
Install as a Cake Tool

Sphere10.Framework.Windows.Forms.Sqlite

SQLite connection editors for Windows Forms. SqliteConnectionBar and SqliteConnectionPanel collect a database filename, password, journal mode and synchronization mode, then expose those settings through IDatabaseConnectionProvider. Use the bar in a tool area and the panel in a settings page or dialog.

Installation and requirements

dotnet add package Sphere10.Framework.Windows.Forms.Sqlite

Use a Windows desktop application targeting net10.0-windows, with the .NET 10 SDK and Windows Forms enabled:

<PropertyGroup>
  <TargetFramework>net10.0-windows</TargetFramework>
  <UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>

Create and access the controls on your application's STA UI thread with a WinForms message loop. The package references its matching data provider and Sphere10.Framework.Windows.Forms; install the UI package into the desktop project that hosts the controls.

The data provider uses System.Data.SQLite and includes SourceGear.sqlite3 as a native dependency. Keep the native runtime assets in the deployed application's output for its selected architecture. These are Windows UI controls even though the separate data library targets net10.0.

Controls and connection settings

The concrete controls are in Sphere10.Framework.Windows.Forms.Sqlite.

API Behavior
ConnectionString Populates or reads the filename, password, journal mode and sync mode.
Filename Read-only current file-selection path; set it through ConnectionString or the UI.
Password, HasPassword Read-only password and whether its trimmed value is nonempty.
Mode File-selector PathSelectionMode; the designer default is File.
DatabaseName Filename without its extension, or null when no path is selected.
GetDAC() Returns a new SqliteDAC as IDAC without opening it.
TestConnection() Opens and disposes a DAC scope on a worker task, returning Task<Result>.
ArtificialKeysFile Bar-only inherited setting, applied when GetDAC() is called.

The initial journal choice is SqliteJournalMode.Default; initial synchronization is SqliteSyncMode.Normal. The combo boxes translate these framework enums to System.Data.SQLite settings.

Add a bar or show a connection dialog

The example uses an existing database file and PathSelectionMode.OpenFile. Run it from the application's STA UI thread. Pass the dialog an initial string produced by SQLiteConnectionStringBuilder or a saved string from these controls.

using System.Data.SQLite;
using System.Windows.Forms;
using Sphere10.Framework.Windows.Forms;
using Sphere10.Framework.Windows.Forms.Sqlite;

public static class SqliteConnectionUi {
	public static SqliteConnectionBar AddBar(Control host, string filename) {
		var settings = new SQLiteConnectionStringBuilder { DataSource = filename, FailIfMissing = true };
		var bar = new SqliteConnectionBar {
			Dock = DockStyle.Top,
			Mode = PathSelectionMode.OpenFile,
			ConnectionString = settings.ConnectionString
		};
		host.Controls.Add(bar);
		return bar;
	}

	public static bool TryEditConnection(IWin32Window owner, string initialConnectionString, out string connectionString) {
		using var dialog = new Form {
			Text = "SQLite connection",
			Width = 640,
			Height = 230,
			StartPosition = FormStartPosition.CenterParent
		};
		var panel = new SqliteConnectionPanel {
			Dock = DockStyle.Fill,
			Mode = PathSelectionMode.OpenFile,
			ConnectionString = initialConnectionString
		};
		var buttons = new FlowLayoutPanel { Dock = DockStyle.Bottom, AutoSize = true, FlowDirection = FlowDirection.RightToLeft };
		var cancel = new Button { Text = "Cancel", DialogResult = DialogResult.Cancel };
		var accept = new Button { Text = "OK", DialogResult = DialogResult.OK };
		buttons.Controls.Add(cancel);
		buttons.Controls.Add(accept);
		dialog.Controls.Add(panel);
		dialog.Controls.Add(buttons);
		dialog.AcceptButton = accept;
		dialog.CancelButton = cancel;

		connectionString = initialConnectionString;
		if (dialog.ShowDialog(owner) != DialogResult.OK)
			return false;
		connectionString = panel.ConnectionString;
		return true;
	}
}

The host owns the added bar. The dialog disposes its panel and buttons after closing; cancellation returns the original connection string unchanged. Pressing OK collects settings without opening or creating a database. After acceptance, obtain bar.GetDAC() or construct new Sphere10.Framework.Data.SqliteDAC(connectionString) for application operations.

Shared provider selection

Register Sphere10.Framework.Windows.Forms.Sqlite.ModuleConfiguration with UseModule<TModule>() in the existing framework startup builder before creating a generic DatabaseConnectionBar or DatabaseConnectionPanel. It supplies named transient implementations under nameof(DBMSType.Sqlite).

After the framework has started, set the generic control's SelectedDBMSType to DBMSType.Sqlite, then assign ConnectionString. Referencing the package alone does not register its module. Concrete SqliteConnectionBar and SqliteConnectionPanel instances can be constructed directly without provider lookup.

Events and connection lifecycle

  • The concrete editors inherit the parameterless StateChanged event from UserControlEx. It reports edited control state, not database connectivity.
  • The generic DatabaseConnectionPanel additionally raises DBMSTypeChanged(panel, dbmsType) when its provider selection changes; the generic bar has no corresponding public event.
  • Await TestConnection() in a UI event handler and inspect Result.IsSuccess. The temporary scope is disposed after the test; success does not retain a live connection. Parsing settings or loading ArtificialKeysFile happens before the method's connection-error handling and can throw separately.
  • Read settings on the UI thread, then use the resulting DAC for work. Dispose application-owned connections or DAC scopes. The editor does not manage a database's lifetime or your transactions.

SQLite behavior and limitations

Every generated connection string includes FailIfMissing=True. Selecting SaveFile or typing a new path does not turn these controls into database-creation tools: create the database separately before testing or opening it. For in-memory databases or specialized connection options, use the data provider directly.

The editor reconstructs its string from the four visible settings. It does not preserve options such as Read Only, pooling or custom URI settings. Apply any additional options after reading ConnectionString and construct the DAC from that final string.

The password is passed to the provider; the presence of a password field does not guarantee encryption support in every native SQLite build. Journal and synchronization choices affect locking, durability and file access, so choose them for the workload and filesystem in use. See the SQLite provider guide for database operations and deployment details. Avoid logging connection strings containing passwords.

Build and source

From the repository root on Windows:

dotnet build src/Sphere10.Framework.Windows.Forms.Sqlite/Sphere10.Framework.Windows.Forms.Sqlite.csproj -c Release

License & Author

License: MIT License

Author: Herman Schoenfeld (sphere10.com)

Copyright: © 2018-Present Herman Schoenfeld. All rights reserved.

Product Compatible and additional computed target framework versions.
.NET net10.0-windows7.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.1.2 97 9/9/2026
3.1.1 98 9/8/2026
3.1.0 97 9/7/2026
3.0.3 171 1/6/2026
3.0.2 138 1/2/2026
3.0.1 133 1/2/2026
3.0.0 137 1/2/2026