NBean 2.1.0-beta-2

.NET Standard 2.0
This is a prerelease version of NBean.
There is a newer prerelease version of this package available.
See the version list below for details.
NuGet\Install-Package NBean -Version 2.1.0-beta-2
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.
dotnet add package NBean --version 2.1.0-beta-2
<PackageReference Include="NBean" Version="2.1.0-beta-2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NBean --version 2.1.0-beta-2
#r "nuget: NBean, 2.1.0-beta-2"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install NBean as a Cake Addin
#addin nuget:?package=NBean&version=2.1.0-beta-2&prerelease

// Install NBean as a Cake Tool
#tool nuget:?package=NBean&version=2.1.0-beta-2&prerelease

NBean is a fork of LimeBean with a couple of additional features, exclusively targeting NetStandard 2.0. It is a highly RedBeanPHP-inspired ORM for .NET which provides a simple and concise API for accessing ADO.NET data sources. It's an Hybrid-ORM ... halfway between a micro-ORM and plain old SQL.

Supported databases include:

  • SQLite
  • MySQL/MariaDB
  • PostgreSQL
  • SQL Server

Getting Started: Basic CRUD (Create/Read/Update/Delete)

For basic usage, NBean requires no configuration or table classes!

Take a look at some basic CRUD scenarios:


// Create a Bean. 
// "Bean" means row, and "Dispense" makes an empty Bean for a table.
var bean = api.Dispense("book");

// Each bean has a "Kind". Kind is a synonym for "table name"
// You give a Bean its Kind when you Dispense it, or query the database
var kind = bean.GetKind();

// Fill the new Bean with some data
bean["title"] = "Three Comrades";
bean["rating"] = 10;

// Store it
// Store() will Create or Update a record intelligently
var id = api.Store(bean);

// You can also use this shortcut and chain .Put() and .Store() to do this
var id2 = api.Dispense("book")
    .Put("title", "The Art Of War")
    .Put("rating", 10)

// Store also returns the Primary Key for the saved Bean, even for multi-column/compound keys

Read and Update

// Load a Bean with a known ID
bean = api.Load("book", id);

// Make some edits
bean["release_date"] = new DateTime(2015, 7, 30);
bean["rating"] = 5;

// Update database

Short version:

api.Load("book", id)                                  // <-- Load a Bean with a known ID
    .Put("release_date", new DateTime(2015, 7, 30))   // <-- make some edits
    .Put("rating", 5)
    .Store();                                         // <-- update database

Note: This version doesn't check for not found Book Bean



// or

api.Load("book", id).Trash();
Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
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
2.1.0-beta-3 105 8/30/2021
2.1.0-beta-2 117 1/9/2021
2.1.0-beta-1 161 1/7/2021