DBBroker 3.0.5

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

DBBroker 3.x

DbBroker logo

A lightweight and easy to use .NET tool and library for effortless database records manipulation.

Benefits

  • Automatically generated Data Models
  • Zero-SQL
  • Compile time database schemas compatibility and change check

NuGet

Package Latest
DBBroker NuGet Version .NET Standard 2.0
DBBroker.Cli NuGet Version

Version 3.x has no backward compatibility with DBBroker 1.x and 2.x

How it works?

DBBroker approach is powerful and different from other ORMs because it associates a .NET CLI tool to automatically generate Data Models and a library that uses those Data Models at runtime to generate SQL and manipulate database records.

Philosophy

DBBroker offers features that benefit any kind of .NET application that interacts with databases, from the simplest to the most complex, particularly in security-restricted scenarios. Here are some key requirements it addresses that other ORMs fail:

  • Applications should NOT be executing DDL.

  • Applications' Data Access Objects should act as clients to the database, not the other way around.

  • Schema Migrations are not an option due to a development process led by Database Administrators.

These are common requirements for many organizations or database-centered solutions, and, arguably, by everyone who likes to keep things simple.

Quick Start⚡

Open your terminal and navigate to your application's *.csproj directory. Then follow these steps:

Step 1: Install DBBroker.Cli .NET tool globally.

dotnet tool install DBBroker.Cli --global

Step 2: Add DBBroker package to your project.

dotnet nuget add DBBroker

Step 3: Create a dbbroker.config.json file at the root of your project.

dbbroker init --namespace="MyApp.DataModels" --connection-string "<my_connection_string>" --provider Oracle

Step 4: Synchronize your project with your database schemas to generate the Data Models.

dbbroker sync

Examples

Entity persistence.

// Data Models classes are generated by DBBroker (dbbroker sync)
var customer = new CustomersDataModel();
customer.Name = "John Three Sixteen";
customer.Birthday = new DateTime(1980, 3, 16);

var id = await dbConnection.InsertAsync(customer);

Entity persistence with transactions.

using var dbConnection = new SqlConnection();
dbConnection.Open();
var transaction = dbConnection.GetTransaction();

try 
{
    var customer = new CustomersDataModel();
    customer.Id = Guid.NewGuid();
    customer.Name = "John Three Sixteen";
    customer.Birthday = new DateTime(1980, 3, 16);

    await dbConnection.InsertAsync(customer, transaction);

    var car = new CarsDataModel();
    car.Model = "Renault Twingo";
    car.Year = 2001;
    car.CustomerId = customer.Id;

    await dbConnection.InsertAsync(car, transaction);
    transaction.Commit();
}
catch(Exception ex)
{
    transaction.Rollback();
}

Retrieving a record.

var result = await dbConnection
    .Select<CustomersDataModel>()
    .AddFilter(x => x.Id, SqlEquals.To("1e6fc0e6-1fe2-49c0-ba37-ec14bf8eddc4"))
    .ExecuteAsync();

var customer = result.FirstOrDefault();

Retrieving multiple and filtered records.

var inactiveCustomers = await dbConnection.Select<CustomersDataModel>()
  .AddFilter(x => x.StatusId, SqlEquals.To(3))
  .ExecuteAsync();

Retrieving multiple records loading only specified columns.

var inactiveCustomers = await dbConnection
    .Select<CustomersDataModel>([
        x => x.Id,
        x => x.Name,
        x => x.Birthday
    ])
    .OrderBy(x => x.Name)
    .AddFilter(x => x.StatusId, SqlEquals.To(3))
    .ExecuteAsync();

Supported Databases

Database Status --provider
SQL Server SqlServer
Oracle Oracle
Postgres ⚒️ Postgres
MySQL 🛣️ MySql

Contribute

All contributions are appreciated, whether they're bug reports, feature suggestions, or pull requests. Thank you for your interest and support in improving this project!

Financial support is also welcome, whether large or small contributions will help to keep this project moving and always secure.

BuyMeACoffee

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
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.0.5 154 12/13/2025
3.0.4 410 12/11/2025
3.0.3 406 12/11/2025
3.0.2-beta 403 12/11/2025
3.0.0-beta 183 1/29/2025
2.0.8 905 7/2/2020
2.0.7 688 6/26/2020
2.0.4-beta 892 10/11/2018
1.1.0 2,958 8/24/2015
1.0.4 2,077 7/21/2015
1.0.3 1,910 7/20/2015
1.0.2 1,486 7/13/2015
1.0.0 1,525 7/10/2015