BullDB 1.0.29

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

BullDB for C# & .NET

One Model. Every Database. Unified Security, AI, and High-Performance for C# / .NET.

BullDB is the world's most advanced cross-language ORM/ODM/Data Access Framework. This is the official NuGet package BullDB.

With BullDB, you define a single Active Record model class and query it seamlessly across relational SQL engines (PostgreSQL, SQLite), document stores (MongoDB), key-value stores (Redis), and vector/graph databases under a unified schema-driven interface.


Installation

Install the package via the .NET CLI:

dotnet add package BullDB

Or via the Package Manager Console:

Install-Package BullDB

Key Features

  1. Attribute-Driven Models: Native C# classes decorated with [Table], [PrimaryKey], [Unique], [Encrypt], and [Hash].
  2. Auto-Migrations: Transparent schema diffing and table modification/reconstruction.
  3. Zero-Dependency Field Encryption: Advanced AES-256-GCM secure field encryption with runtime key override (SecurityEngine.SetEncryptionKey) and secure random fallbacks.
  4. Cross-Language Compatibility: Standardized binary payload layout (nonce (12b) + tag (16b) + ciphertext) allowing decryption across Python, TypeScript, Go, Rust, and C#.
  5. Asynchronous API: Fully async-await compatible methods for database operations.
  6. Native AI Embeddings & RAG: Built-in HTTP clients and similarity search pipelines.

Quick Start Example

Here is a complete, ready-to-run C# example:

using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using BullDB;

namespace BullDBExample
{
    // 1. Define your Active Record model class with Attributes
    [Table("users")]
    public class User : BaseModel
    {
        [PrimaryKey]
        public string Id { get; set; } = "";

        [Unique]
        public string Email { get; set; } = "";

        [Encrypt]
        public string SecretNote { get; set; } = "";

        [Hash]
        public string Password { get; set; } = "";
    }

    class Program
    {
        static async Task Main(string[] args)
        {
            // 2. Setup Multi-Engine Database Connection
            var db = DB.Instance;
            await db.ConnectAllAsync();

            // 3. Initialize and run schema migrations
            var migrator = new MigrationEngine();
            migrator.RegisterModel(typeof(User));
            await migrator.GenerateAndApplySchemaAsync();

            // 4. Optional: Override default encryption key at runtime
            // (Default: uses BULLDB_ENCRYPTION_KEY env, or generates a secure random session key)
            SecurityEngine.SetEncryptionKey(Encoding.UTF8.GetBytes("my-custom-super-secret-key-32b-length"));

            // 5. Create and save a user
            var user = await BaseModel.CreateAsync<User>(new Dictionary<string, object>
            {
                { "Email", "developer@example.com" },
                { "SecretNote", "This is highly confidential C# data." },
                { "Password", "mySecurePassword123" }
            });
            Console.WriteLine($"Created User ID: {user.Id}");

            // Note: SecretNote is encrypted and Password is salted + hashed in the database!
            // Let's verify password verification flow
            var rawRows = await db.ExecuteAsync("SELECT * FROM users WHERE id = ?", new object[] { user.Id });
            var hashedPasswordInDb = (string)rawRows[0]["password"];
            bool isPasswordCorrect = SecurityEngine.VerifyPassword("mySecurePassword123", hashedPasswordInDb);
            Console.WriteLine($"Password Matches: {isPasswordCorrect}"); // True

            // 6. Retrieve the user
            // Fetch by ID (automatic decryption of encrypted fields on load)
            var fetched = await BaseModel.GetByIdAsync<User>(user.Id);
            Console.WriteLine($"Decrypted Secret Note: {fetched.SecretNote}"); // "This is highly confidential C# data."

            // Find first record matching conditions
            var firstUser = await BaseModel.FindFirstAsync<User>(new Dictionary<string, object> { { "email", "developer@example.com" } });
            Console.WriteLine($"Found User ID: {firstUser?.Id}");

            // 7. Clean up / delete user
            bool deleted = await user.DeleteAsync();
            Console.WriteLine($"User Deleted: {deleted}");

            await db.DisconnectAllAsync();
        }
    }
}

AI Embeddings & RAG Pipelines

C# includes a built-in semantic search RAG Pipeline:

using BullDB;

var db = DB.Instance;
var pipeline = new RAGPipeline<TestDocument>(db, "VectorVal", "Text");

// Ingest a document
string docId = await pipeline.IngestDocumentAsync("High performance .NET data management.");

// Query similarity
var results = await pipeline.QuerySimilarityAsync("data management", 1);
Console.WriteLine($"Similarity Match: {results[0].Text}");

License

This package is licensed under the MIT License.

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.
  • net8.0

    • No dependencies.

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
1.0.29 141 7/9/2026
1.0.28 119 7/8/2026
1.0.27 120 7/8/2026
1.0.26 96 7/7/2026
1.0.25 114 7/7/2026
1.0.24 112 7/7/2026
1.0.23 122 7/7/2026
1.0.22 122 7/7/2026
1.0.21 121 7/7/2026
1.0.20 133 6/23/2026
1.0.19 116 6/22/2026
1.0.18 115 6/22/2026
1.0.17 112 6/22/2026
1.0.16 117 6/22/2026
1.0.15 115 6/22/2026
1.0.14 125 6/22/2026
1.0.0.13 121 6/22/2026
1.0.0.12 123 6/22/2026
1.0.0 133 6/22/2026