Sphere10.Framework.Data.Firebird 3.0.3

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

💾 Sphere10.Framework.Data.Firebird

Firebird database implementation for Sphere10.Framework.Data abstraction layer, providing open-source relational database access with ACID compliance and advanced SQL features.

Sphere10.Framework.Data.Firebird brings powerful open-source database capabilities to the Sphere10 Framework while maintaining database-agnostic abstraction. Supports both embedded (single-file) and server architectures, making it ideal for desktop applications, small-to-medium enterprises, and resource-constrained environments.

📦 Installation

dotnet add package Sphere10.Framework.Data.Firebird

⚡ 10-Second Example

using Sphere10.Framework.Data;

// Connect to Firebird database
var dac = Tools.Firebird.Open(
    "ServerType=1;DataSource=localhost;Database=myapp.fdb;User=sysdba;Password=masterkey");

// Create table with Firebird dialect
dac.ExecuteNonQuery(@"CREATE TABLE Users (
    ID INTEGER PRIMARY KEY,
    Name VARCHAR(100) NOT NULL,
    Email VARCHAR(100)
)");

// Insert record
dac.Insert("Users", new[] {
    new ColumnValue("ID", 1),
    new ColumnValue("Name", "Alice"),
    new ColumnValue("Email", "alice@example.com")
});

// Query with parameters
var users = dac.ExecuteQuery(
    "SELECT * FROM Users WHERE Name LIKE @search",
    new ColumnValue("@search", "%Alice%"));

🏗️ Core Concepts

Embedded & Server Modes: Single-file database for embedded scenarios or server deployment for multi-user access.

ACID Compliance: Full transaction support with isolation levels for data consistency and reliability.

Stored Procedures & Triggers: PL/SQL stored procedures and trigger support for complex business logic.

Multi-Generational Architecture: Advanced transaction architecture enabling long-running queries without blocking writers.

SQL Dialect: Firebird-specific SQL syntax with advanced features like EXECUTE BLOCK and stored procedure definitions.

🔧 Core Examples

Connection Strings & Database Setup

using Sphere10.Framework.Data;

// Local server connection (server-based Firebird)
var serverDac = Tools.Firebird.Open(
    "ServerType=1;DataSource=localhost;Database=myapp.fdb;User=sysdba;Password=masterkey");

// Embedded database (single-file, no server required)
var embeddedDac = Tools.Firebird.Open(
    "DataSource=C:\\data\\myapp.fdb;User=sysdba;Password=masterkey;ServerType=0");

// Remote server
var remoteDac = Tools.Firebird.Open(
    "ServerType=1;DataSource=db.company.com;Database=/opt/firebird/myapp.fdb;User=admin;Password=P@ssw0rd");

// Connection pooling
var pooledDac = Tools.Firebird.Open(
    "ServerType=1;DataSource=localhost;Database=myapp.fdb;User=sysdba;Password=masterkey;Pooling=true;MinPoolSize=5;MaxPoolSize=20");

CRUD Operations with Generator Keys

using Sphere10.Framework.Data;

var dac = Tools.Firebird.Open(
    "DataSource=shop.fdb;User=sysdba;Password=masterkey");

// Create table with generator (sequence)
dac.ExecuteNonQuery(@"
    CREATE TABLE Products (
        ID INTEGER PRIMARY KEY,
        Name VARCHAR(100) NOT NULL,
        Price DECIMAL(10,2),
        StockQuantity INTEGER
    )");

// Create generator (sequence) for auto-incrementing IDs
dac.ExecuteNonQuery("CREATE SEQUENCE GEN_PRODUCTS_ID");

// Insert records with generator
dac.ExecuteNonQuery(@"
    INSERT INTO Products (ID, Name, Price, StockQuantity)
    VALUES (NEXT VALUE FOR GEN_PRODUCTS_ID, 'Laptop', 999.99, 50)");

dac.ExecuteNonQuery(@"
    INSERT INTO Products (ID, Name, Price, StockQuantity)
    VALUES (NEXT VALUE FOR GEN_PRODUCTS_ID, 'Mouse', 29.99, 200)");

// Query all records
var products = dac.ExecuteQuery("SELECT * FROM Products");

// Parameterized query
var expensiveProducts = dac.ExecuteQuery(
    "SELECT * FROM Products WHERE Price > ? ORDER BY Price DESC",
    new ColumnValue(null, 100.0));

// Update product
dac.Update("Products",
    new[] {
        new ColumnValue("StockQuantity", 45),
        new ColumnValue("Price", 1099.99)
    },
    "WHERE Name = ?",
    new ColumnValue(null, "Laptop"));

// Delete low-stock items
dac.ExecuteNonQuery(
    "DELETE FROM Products WHERE StockQuantity < ?",
    new ColumnValue(null, 10));

Transactions & ACID Properties

using Sphere10.Framework.Data;

var dac = Tools.Firebird.Open(
    "DataSource=bank.fdb;User=sysdba;Password=masterkey");

// Create account table
dac.ExecuteNonQuery(@"
    CREATE TABLE Accounts (
        ID INTEGER PRIMARY KEY,
        AccountNumber VARCHAR(20) UNIQUE NOT NULL,
        Balance DECIMAL(18,2) NOT NULL,
        LastModified TIMESTAMP DEFAULT CURRENT_TIMESTAMP
    )");

// Initialize accounts
dac.ExecuteNonQuery(@"
    CREATE SEQUENCE GEN_ACCOUNTS_ID");

dac.Insert("Accounts", new[] {
    new ColumnValue("ID", 1),
    new ColumnValue("AccountNumber", "ACC001"),
    new ColumnValue("Balance", 10000.00)
});

dac.Insert("Accounts", new[] {
    new ColumnValue("ID", 2),
    new ColumnValue("AccountNumber", "ACC002"),
    new ColumnValue("Balance", 5000.00)
});

// Transactional money transfer with Firebird's multi-generational architecture
using (var scope = dac.BeginTransactionScope()) {
    try {
        // Withdraw from source account
        dac.ExecuteNonQuery(
            "UPDATE Accounts SET Balance = Balance - ? WHERE ID = 1",
            new ColumnValue(null, 1000.00));

        // Verify sufficient funds
        var balance = dac.ExecuteScalar<decimal>(
            "SELECT Balance FROM Accounts WHERE ID = 1");
        
        if (balance < 0) {
            throw new Exception("Insufficient funds");
        }

        // Deposit to destination account
        dac.ExecuteNonQuery(
            "UPDATE Accounts SET Balance = Balance + ? WHERE ID = 2",
            new ColumnValue(null, 1000.00));

        scope.Commit();
    } catch (Exception ex) {
        Console.WriteLine($"Transfer failed: {ex.Message}");
        // Auto-rollback
    }
}

// Verify final balances
var acc1Balance = dac.ExecuteScalar<decimal>(
    "SELECT Balance FROM Accounts WHERE ID = 1");
var acc2Balance = dac.ExecuteScalar<decimal>(
    "SELECT Balance FROM Accounts WHERE ID = 2");

Console.WriteLine($"Account 1: {acc1Balance}");  // 9000.00
Console.WriteLine($"Account 2: {acc2Balance}");  // 6000.00

Stored Procedures & Triggers

using Sphere10.Framework.Data;

var dac = Tools.Firebird.Open(
    "DataSource=app.fdb;User=sysdba;Password=masterkey");

// Create stored procedure using EXECUTE BLOCK
dac.ExecuteNonQuery(@"
    CREATE PROCEDURE GetProductsByPrice(MaxPrice DECIMAL(10,2))
    RETURNS (
        ProductID INTEGER,
        ProductName VARCHAR(100),
        ProductPrice DECIMAL(10,2)
    )
    AS
    BEGIN
        FOR SELECT ID, Name, Price FROM Products WHERE Price <= :MaxPrice
        INTO :ProductID, :ProductName, :ProductPrice
        DO SUSPEND;
    END");

// Execute stored procedure
var cheapProducts = dac.ExecuteQuery(
    "EXECUTE PROCEDURE GetProductsByPrice ?",
    new ColumnValue(null, 50.00));

// Create audit trigger
dac.ExecuteNonQuery(@"
    CREATE TABLE AuditLog (
        AuditID INTEGER PRIMARY KEY,
        TableName VARCHAR(50),
        Action VARCHAR(10),
        AuditTime TIMESTAMP DEFAULT CURRENT_TIMESTAMP
    )");

dac.ExecuteNonQuery(@"
    CREATE TRIGGER PRODUCTS_AUDIT AFTER UPDATE ON Products
    AS
    BEGIN
        INSERT INTO AuditLog (TableName, Action)
        VALUES ('Products', 'UPDATE');
    END");

// Update triggers audit log automatically
dac.Update("Products",
    new[] { new ColumnValue("Price", 99.99) },
    "WHERE ID = 1");

🏗️ Architecture

FirebirdDatabaseManager: Core implementation of IDataAccessContext for Firebird operations.

Embedded vs Server: Supports both embedded single-file databases and server-based deployments.

Generator Support: Firebird generators (sequences) for auto-incrementing values using NEXT VALUE FOR.

PL/SQL Integration: Full stored procedure and trigger support using Firebird PL/SQL dialect.

Multi-Generational Transactions: Concurrent readers and writers with minimal blocking.

📋 Best Practices

  • Use embedded mode for desktop applications with single concurrent user
  • Deploy server mode for multi-user environments requiring higher throughput
  • Create generators (sequences) for auto-incrementing primary keys
  • Leverage stored procedures for complex business logic
  • Use transaction isolation levels appropriate for your consistency requirements
  • Monitor database statistics and maintain indexes for performance
  • Use TIMESTAMP DEFAULT CURRENT_TIMESTAMP for audit trails
  • Enable archiving for large transaction logs

📊 Status & Compatibility

  • Framework: .NET 5.0+, .NET Framework 4.7+
  • Firebird Versions: 2.5+, 3.0+, 4.0+
  • Performance: Good for small-to-medium databases, embedded and server deployments
  • Concurrency: Multi-generational architecture supports concurrent readers and writers

📦 Dependencies

  • Sphere10.Framework.Data: Data abstraction layer
  • FirebirdSql.Data.FirebirdClient: Firebird .NET provider
  • .NET Standard 2.1+: Cross-platform compatibility

📄 License & Author

License: Refer to repository LICENSE
Author: Herman Schoenfeld, Sphere 10 Software (sphere10.com)
Copyright: © 2018-Present Herman Schoenfeld & Sphere 10 Software. All rights reserved.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Sphere10.Framework.Data.Firebird:

Package Downloads
Sphere10.Framework.Windows.Forms.Firebird

Windows Forms integration for Sphere10.Framework.Data.Firebird. Provides desktop UI helpers and components intended to work with Sphere10 Framework WinForms and the Firebird provider for data-driven applications.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.0.3 89 1/6/2026
3.0.2 87 1/2/2026
3.0.1 85 1/2/2026
3.0.0 83 1/2/2026