DBBroker 3.0.2-beta

Prefix Reserved
This is a prerelease version of DBBroker.
There is a newer version of this package available.
See the version list below for details.
dotnet add package DBBroker --version 3.0.2-beta
                    
NuGet\Install-Package DBBroker -Version 3.0.2-beta
                    
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.2-beta" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DBBroker" Version="3.0.2-beta" />
                    
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.2-beta
                    
#r "nuget: DBBroker, 3.0.2-beta"
                    
#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.2-beta
                    
#: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.2-beta&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=DBBroker&version=3.0.2-beta&prerelease
                    
Install as a Cake Tool

<div align="center"> <img src="/assets/logo-with-name.png" alt="DBBroker logo" /> <br/> A lightweight and easy to use .NET tool and library for effortless database records manipulation. </div>

NuGet

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

IMPORTANT: This version has no backward compatibility with DBBroker 1.x and 2.x.

What It Does?

Differently from another popular ORM packages, DBBroker approach associates a .NET CLI tool to automatically generate Data Models and a library that uses those Data Models at runtime to manipulate database records.

Philosophy

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

  • Applications should NOT be responsible for 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 _dbBroker.InsertAsync(customer);

Entity persistence with transactions.

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

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

    await connection.InsertAsync(customer, transaction);

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

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

Retrieving a record.

var customer = await connection.GetByKey<CustomersDataModel>("543491fa-788a-474c-9f3b-6ed6566e5d2c");

Retrieving multiple and filtered records.

var inactiveCustomers = await connection.Select<CustomersDataModel>()
  .AddFilter(x => x.StatusId, SqlEquals.To(3))
  .FetchFirst(records: 100, skip: 300) // helps implement a 'load more' or pagination strategy
  .ExecuteAsync();
// another example with columns
// another example with columns and order by

Supported Databases

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

Contribute

We appreciate all contributions, 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 282 12/13/2025
3.0.4 465 12/11/2025
3.0.3 465 12/11/2025
3.0.2-beta 471 12/11/2025
3.0.0-beta 236 1/29/2025
2.0.8 966 7/2/2020
2.0.7 748 6/26/2020
2.0.4-beta 955 10/11/2018
1.1.0 3,058 8/24/2015
1.0.4 2,171 7/21/2015
1.0.3 2,006 7/20/2015
1.0.2 1,568 7/13/2015
Loading failed