Sphere10.Framework.Windows.Forms.Firebird 3.2.0

dotnet add package Sphere10.Framework.Windows.Forms.Firebird --version 3.2.0
                    
NuGet\Install-Package Sphere10.Framework.Windows.Forms.Firebird -Version 3.2.0
                    
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.Firebird" Version="3.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Sphere10.Framework.Windows.Forms.Firebird" Version="3.2.0" />
                    
Directory.Packages.props
<PackageReference Include="Sphere10.Framework.Windows.Forms.Firebird" />
                    
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.Firebird --version 3.2.0
                    
#r "nuget: Sphere10.Framework.Windows.Forms.Firebird, 3.2.0"
                    
#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.Firebird@3.2.0
                    
#: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.Firebird&version=3.2.0
                    
Install as a Cake Addin
#tool nuget:?package=Sphere10.Framework.Windows.Forms.Firebird&version=3.2.0
                    
Install as a Cake Tool

Sphere10.Framework.Windows.Forms.Firebird

Sphere10.Framework.Windows.Forms.Firebird provides Windows Forms editors for Firebird connection settings in desktop applications that use Sphere10 Framework data access. It covers a Firebird server and an embedded database file, each with a compact one-row bar and a larger panel for a settings page or a dialog. All four editors build a FirebirdSql.Data.FirebirdClient connection string, test it on request and create a FirebirdDAC from it.

Reference the package

Add the package from your configured feed, and keep its version in step with your other Sphere10 Framework packages:

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

The package depends on Sphere10.Framework.Data.Firebird, which supplies FirebirdDAC and the FirebirdSql.Data.FirebirdClient driver, and on Sphere10.Framework.Windows.Forms. To build against source instead, reference src/Sphere10.Framework.Windows.Forms.Firebird/Sphere10.Framework.Windows.Forms.Firebird.csproj with a ProjectReference.

The project targets net10.0-windows, and a build with a .NET 11 SDK also targets net11.0-windows. Like the other WinForms packages it needs the .NET 10 UI APIs, although the data provider underneath targets net8.0 and later. A consuming project needs a Windows target framework with Windows Forms enabled:

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

Create and use the controls on the application's UI thread. Creating or editing a control never connects, so a Firebird server is needed only to test or open a server connection. Embedded mode runs the Firebird engine inside the application process, so the application must deploy Firebird's native client and engine files for its architecture. The managed driver package does not include them.

Domains

Every folder of Sphere10.Framework.Windows.Forms.Firebird is a domain with its own README, which lists all of its public types.

Domain What it provides Source

Project root

Types declared in the project folder itself:

Type Kind Purpose
FirebirdConnectionBar class One-row ConnectionBarBase editor for a Firebird server, port, database, user name and password that builds an FbConnectionStringBuilder connection string and creates a FirebirdDAC.
FirebirdConnectionPanel class Larger ConnectionPanelBase editor with the same fields as FirebirdConnectionBar, for a settings page or dialog.
FirebirdEmbeddedConnectionBar class One-row editor for an embedded Firebird database file, user name and password that builds an embedded-server connection string and exposes Filename, Password and the file selector's Mode.
FirebirdEmbeddedConnectionPanel class Larger editor with the same fields as FirebirdEmbeddedConnectionBar, for a settings page or dialog.
ModuleConfiguration class Registers the server editors under DBMSType.Firebird and the embedded editors under DBMSType.FirebirdFile as named transient ConnectionBarBase and ConnectionPanelBase services.

Controls

All four controls are in the Sphere10.Framework.Windows.Forms.Firebird namespace. The bars derive from ConnectionBarBase and fit a toolbar or header area, and their options button can select an artificial-keys file. The panels derive from ConnectionPanelBase.

Mode Bar Panel Server type Selector key
Server FirebirdConnectionBar FirebirdConnectionPanel FbServerType.Default DBMSType.Firebird
Embedded file FirebirdEmbeddedConnectionBar FirebirdEmbeddedConnectionPanel FbServerType.Embedded DBMSType.FirebirdFile
Member Editors Behavior
Server Server Server host, mapped to FbConnectionStringBuilder.DataSource.
Port Server Port as text. A blank port is left out of the string. Loading a string shows the builder's port, which is the driver default when the string has none.
Database, DatabaseName Server Database path or alias, as the server resolves it. DatabaseName returns the Database text and does not query the server.
Username, Password Server Account name and password, mapped to UserID and Password. The password box masks its text, but both properties return plain text.
Filename Embedded Read-only path of the database file. Set it through ConnectionString or the file selector.
Mode Embedded PathSelectionMode of the file selector, such as OpenFile for an existing file.
Password, HasPassword Embedded Read-only password text, and whether it contains a non-whitespace character.
DatabaseName Embedded File name without its extension, or null when no file is selected.
ConnectionString All Builds a string from the editor's fields and server type, or fills the fields from an assigned string.
GetDAC() All Returns a new FirebirdDAC as IDAC without opening a connection.
TestConnection() All Opens and closes a test connection, and returns Task<Result>.
ArtificialKeysFile Bars Path of an artificial-keys XML file. The options button sets it through SelectArtificialKeysFile() and can clear it again. GetDAC() loads the file into each new DAC, so that GetSchema() includes the keys it declares.

The embedded editors also have a Username box but no public Username property, so set the user name through ConnectionString or the UI. ConnectionString is hidden from the Windows Forms designer, but the server editors' field properties are not. Assign credentials at runtime so that they never reach designer-generated code.

Edit and test a connection

Place a panel on a designer-authored dialog, form or screen like any other control, and host a bar the same way where space is limited. The code-behind below belongs to a dialog whose designer file declares _connectionPanel (a FirebirdConnectionPanel), _testButton and _statusLabel, wires _testButton.Click, and sets the DialogResult of its OK and Cancel buttons.

using System;
using System.ComponentModel;
using System.Windows.Forms;

public partial class DatabaseSettingsDialog : Form {
	public DatabaseSettingsDialog() {
		InitializeComponent();
	}

	[Browsable(false)]
	[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
	public string ConnectionString {
		get => _connectionPanel.ConnectionString;
		set => _connectionPanel.ConnectionString = value;
	}

	private async void _testButton_Click(object sender, EventArgs e) {
		_testButton.Enabled = false;
		try {
			var result = await _connectionPanel.TestConnection();
			if (!IsDisposed)
				_statusLabel.Text = result.IsSuccess ? "Connection succeeded." : string.Join(Environment.NewLine, result.ErrorMessages);
		} catch (Exception error) {
			// Settings that cannot form a connection string throw instead of failing the result.
			if (!IsDisposed)
				_statusLabel.Text = error.Message;
		} finally {
			if (!IsDisposed)
				_testButton.Enabled = true;
		}
	}
}

Show the dialog with the saved string, and keep the edited string only when the user accepts it:

using var dialog = new DatabaseSettingsDialog { ConnectionString = savedConnectionString };
if (dialog.ShowDialog(owner) == DialogResult.OK)
	savedConnectionString = dialog.ConnectionString;

A FirebirdEmbeddedConnectionPanel works the same way. Set its Mode to PathSelectionMode.OpenFile in the designer when the user must choose an existing file.

The editors only collect settings. They do not save profiles, discover servers or create databases, and they never hold a connection:

  • TestConnection() builds the connection string on the calling thread, then opens and disposes a DAC scope on a thread-pool task. A connection failure becomes an error in the returned Result, and no connection stays open afterwards. A successful test shows that a connection opened, not that the application's tables or permissions are in place. The method takes no cancellation token.
  • Building the string can throw before the test starts. Both server editors throw a FormatException for port text that is not a number, and loading a bar's ArtificialKeysFile can also fail.
  • When the application needs the database, call GetDAC() on the editor or construct new FirebirdDAC(connectionString), then call EnterScope() for each unit of work and dispose the scope. The DAC itself is not disposable, and the scope owns the connection.
  • StateChanged, inherited from UserControlEx, is a parameterless event that is raised when a field changes after the control has loaded. It reports edits, not connectivity.

For example, this unit of work deletes the stored sessions in one transaction on the accepted string:

using Sphere10.Framework.Data;

var dac = new FirebirdDAC(savedConnectionString);
using (var scope = dac.EnterScope()) {
	scope.BeginTransaction();
	dac.ExecuteNonQuery("DELETE FROM sessions");
	scope.Commit();
}

Disposing the scope does not commit, so call Commit() explicitly.

Host an editor in code

The editors also work without the designer. The helper below adds a server bar to an existing form or container, and builds an embedded-file dialog around FirebirdEmbeddedConnectionPanel with the standard Form.ShowDialog(owner) API. Call it from the application's UI thread. Pass the bar a server string, for example one built with FbConnectionStringBuilder from the server, the database alias and the application's credentials. Pass the dialog a string with Database, User ID and any password the file needs.

using System.Windows.Forms;
using Sphere10.Framework.Windows.Forms;
using Sphere10.Framework.Windows.Forms.Firebird;

public static class FirebirdConnectionUi {
	public static FirebirdConnectionBar AddServerBar(Control host, string connectionString) {
		var bar = new FirebirdConnectionBar { Dock = DockStyle.Top, ConnectionString = connectionString };
		host.Controls.Add(bar);
		return bar;
	}

	public static bool TryEditEmbeddedConnection(IWin32Window owner, string initialConnectionString, out string connectionString) {
		using var dialog = new Form {
			Text = "Embedded Firebird connection",
			Width = 650,
			Height = 210,
			StartPosition = FormStartPosition.CenterParent
		};
		var panel = new FirebirdEmbeddedConnectionPanel {
			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 it closes, and cancelling returns the original string unchanged. Pressing OK collects the settings without connecting. Use FirebirdConnectionPanel in the same dialog for server settings, or FirebirdEmbeddedConnectionBar for a compact file editor.

Connection string behavior

  • Each editor writes its own server type, whatever the assigned string contained. Choose the editor, or the selector key, that matches the deployment.
  • The editors rebuild the string from their fields, so other settings in an assigned string are dropped, such as the character set, role, pooling or client-library location. To keep such settings, read ConnectionString, add them with FbConnectionStringBuilder, and construct FirebirdDAC from the result. GetDAC() and TestConnection() always use the rebuilt string.
  • Both server editors parse the port strictly, so validate the port text before reading ConnectionString when the user should see a friendlier message than the FormatException.
  • Choosing a file does not create a database. Create the database separately before testing a connection to it.
  • The setters leave a field blank when FbConnectionStringBuilder cannot return its value. A string that the builder rejects outright still throws.
  • Connection strings contain the password, so do not log or display them.

Use the generic provider selector

DatabaseConnectionPanel and DatabaseConnectionBar in Sphere10.Framework.Windows.Forms let the user choose a database engine and then show that engine's editor. They resolve the editors as named framework services, so add this package's module to the application's startup code:

Sphere10Framework.Instance
	.BuildWinFormsApplication()
	// ... the application's existing configuration and modules ...
	.AddModule<Sphere10.Framework.Windows.Forms.Firebird.ModuleConfiguration>()
	.StartWinFormsApplication();

ModuleConfiguration registers the server editors under nameof(DBMSType.Firebird) and the embedded editors under nameof(DBMSType.FirebirdFile), as transient services. The selectors list them as Firebird and Firebird Embedded, and IgnoreDBMS = new[] { DBMSType.FirebirdFile } hides the embedded entry. Referencing the package does not register the editors, and a directly hosted Firebird editor needs no module.

  • A selector constructed before the framework has started, for example in the Windows Forms designer, finds no service provider and lists no engines, so construct it after startup. Switching engines disposes the previous editor.
  • The engine list contains only registered providers. Setting SelectedDBMSType to an unregistered engine leaves the current editor selected.
  • Set SelectedDBMSType to DBMSType.Firebird or DBMSType.FirebirdFile before assigning ConnectionString, because the selector passes the string to its current editor.
  • Database returns the engine and the string together as a DBReference, and the bar also accepts one. DACFactory.CreateDAC(reference.DBMSType, reference.ConnectionString) recreates the DAC from a saved reference.
  • DatabaseConnectionPanel raises DBMSTypeChanged(panel, dbmsType) when the selected engine changes. DatabaseConnectionBar has no such event.

This complete Program.cs starts only the modules that the selector needs, shows it with the Firebird server editor selected and ends the framework after the window closes. Select DBMSType.FirebirdFile instead for the embedded editor.

using System;
using System.Drawing;
using System.Windows.Forms;
using Sphere10.Framework.Application;
using Sphere10.Framework.Data;
using Sphere10.Framework.Windows.Forms;
using ProviderModule = Sphere10.Framework.Windows.Forms.Firebird.ModuleConfiguration;
using WinFormsModule = Sphere10.Framework.Windows.Forms.ModuleConfiguration;
using Application = System.Windows.Forms.Application;

namespace ReadmeExamples.FirebirdSelector;

internal static class Program {
	[STAThread]
	private static void Main() {
		Application.EnableVisualStyles();
		Application.SetCompatibleTextRenderingDefault(false);
		var framework = Sphere10Framework.Instance;
		framework.Build()
			.AddModule<WinFormsModule>()
			.AddModule<ProviderModule>()
			.Start();
		using var shutdown = Tools.Scope.ExecuteOnDispose(framework.EndFramework);
		using var window = new Form { Text = "Database connection", ClientSize = new Size(660, 220) };
		var selector = new DatabaseConnectionPanel {
			Dock = DockStyle.Fill,
			SelectedDBMSType = DBMSType.Firebird
		};
		window.Controls.Add(selector);
		Application.Run(window);
	}
}

In an existing framework application, add the module to its startup builder instead of starting a second framework. Register the modules of other providers to add their engines to the selector.

Save the selector's Database to keep the engine with the string, and recreate the DAC from it later. DACFactory creates a FirebirdDAC for both Firebird keys.

using Sphere10.Framework.Data;

var saved = selector.Database;

var dac = DACFactory.CreateDAC(saved.DBMSType, saved.ConnectionString);
using (dac.EnterScope()) {
	var customers = dac.ExecuteScalar<long>("SELECT COUNT(*) FROM customers");
}

Try the controls

The WinForms Tester hosts all four editors. Run it from the repository root on Windows:

dotnet run --project utils/Sphere10.Framework.Utils.WinFormsTester -c Release -f net10.0-windows -p:BuildRevision=0
  • Controls > Input > All controls by class name opens the control catalog. Search for Firebird to edit sample settings in each editor, which never connect on their own.
  • Integration > Connections > Database Connection Panel and Database Connection Bar show the generic selectors with every provider module registered. Choose Firebird or Firebird Embedded, enter real settings and click Test connection.

Build from source

From the repository root on Windows:

dotnet build src/Sphere10.Framework.Windows.Forms.Firebird/Sphere10.Framework.Windows.Forms.Firebird.csproj -c Release -p:BuildRevision=0

-p:BuildRevision=0 keeps a development build from taking the next local build number. The root README explains build numbering, and how scripts/pack.ps1 packs the whole package set. The project packs this file as its NuGet readme, and Directory.Packages.props sets the driver version.

License and 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.  net11.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.2.0 0 11/24/2026
3.2.0-ci.173.45375449609.1 0 11/24/2026
3.2.0-ci.171.45374063975.1 0 11/24/2026
3.2.0-ci.169.45350717665.1 0 11/24/2026
3.2.0-ci.168.45166918016.1 39 11/23/2026
3.2.0-ci.163.43664782937.1 64 11/15/2026
3.2.0-ci.160.43660265392.1 66 11/15/2026
3.2.0-ci.159.43537748063.1 69 11/14/2026
3.2.0-ci.158.43536665157.1 64 11/14/2026
3.2.0-ci.157.43350632870.1 70 11/13/2026
3.2.0-ci.156.43233095581.1 67 11/12/2026
3.1.2 157 9/9/2026
3.1.1 126 9/8/2026
3.1.0 122 9/7/2026
3.0.3 179 1/6/2026
3.0.2 161 1/2/2026
3.0.1 154 1/2/2026
3.0.0 152 1/2/2026