NBean 2.1.0-beta-3
dotnet add package NBean --version 2.1.0-beta-3
NuGet\Install-Package NBean -Version 2.1.0-beta-3
<PackageReference Include="NBean" Version="2.1.0-beta-3" />
paket add NBean --version 2.1.0-beta-3
#r "nuget: NBean, 2.1.0-beta-3"
// Install NBean as a Cake Addin #addin nuget:?package=NBean&version=2.1.0-beta-3&prerelease // Install NBean as a Cake Tool #tool nuget:?package=NBean&version=2.1.0-beta-3&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
// 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();
Console.WriteLine(kind);
// 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();
// Store also returns the Primary Key for the saved Bean, even for multi-column/compound keys
Console.WriteLine(id);
Console.WriteLine(id2);
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
api.Store(bean);
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
Delete
api.Trash(bean);
// or
api.Load("book", id).Trash();
Product | Versions 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. |
.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. |
-
.NETStandard 2.0
- Mapster (>= 7.0.1)
- Sequel (>= 3.1.0)
- System.Data.SqlClient (>= 4.8.2)
- System.Reflection.Emit (>= 4.7.0)
- System.Reflection.Emit.Lightweight (>= 4.7.0)
- System.Text.Json (>= 4.7.2)
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 | 204 | 8/30/2021 |
2.1.0-beta-2 | 180 | 1/9/2021 |
2.1.0-beta-1 | 228 | 1/7/2021 |