Naravel.Database 0.2.0

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

Naravel.Database

NuGet Downloads .NET 10 License: MIT

Laravel-style query builder for Naravel on ADO.NET and Dapper: named connections on Naravel.Foundation, a connection and transaction seam that EF Core can share, and per-database driver packages.

Fact Detail
Install dotnet add package Naravel.Database
Targets .NET 10
Needs Naravel.Foundation and Naravel.Pagination, which NuGet installs with it
Drivers SQLite, MySQL, PostgreSQL and SQL Server, one package each (listed below)

What you get

  • A fluent query builder on ADO.NET and Dapper: db.Table("users").Where("active", true).OrderBy("name"), with the values bound as parameters.
  • Named connections. Default names the connection IDatabase uses and db.Connection("reports") gives another, so one application can use several databases.
  • Four databases. The Driver of a connection is sqlite, mysql, pgsql or sqlserver, and each value has its own driver package.
  • One transaction with EF Core. With Naravel.Database.EntityFrameworkCore, a DbContext write and a query-builder write commit or roll back together.
  • Raw SQL and a query log. ? placeholders become bound parameters, and the opt-in AddNaravelDatabaseQueryLog() keeps the last queries for development and tests.

Quick start

The connection Driver picks a driver package, which you install next to this one; the sample uses SQLite:

dotnet add package Naravel.Database.Sqlite
{ "Database": { "Default": "main", "Connections": { "main": { "Driver": "sqlite", "Path": "app.db" } } } }
using Naravel.Database;

builder.Services.AddNaravelDatabase(builder.Configuration);         // reads the "Database" section and registers IDatabase for the default connection
builder.Services.AddNaravelSqliteDatabase(builder.Configuration);   // the driver package that the Driver of the connection names; this package has none

public sealed class UserService(IDatabase db)
{
    public Task<IReadOnlyList<IReadOnlyDictionary<string, object?>>> ActiveAsync(CancellationToken ct) =>
        db.Table("users").Where("active", true).OrderBy("name").GetAsync(ct);
}

Rows come back as dictionaries, or as your own type with GetAsync<T>(), which maps through Dapper and is not trim or AOT safe. Raw SQL goes through db.SelectAsync(sql, bindings, ct) with ? placeholders, each one bound as a parameter.

Package Adds
Naravel.Database.EntityFrameworkCore A DbContext and the query builder share one connection and one transaction
Naravel.Database.MySql MySQL driver on MySqlConnector
Naravel.Database.Postgres PostgreSQL driver on Npgsql
Naravel.Database.SqlServer SQL Server driver on Microsoft.Data.SqlClient
Naravel.Database.Sqlite SQLite driver on Microsoft.Data.Sqlite

Learn more

Part of Naravel: Laravel's names, .NET's type system. All Naravel packages share one version.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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.

NuGet packages (5)

Showing the top 5 NuGet packages that depend on Naravel.Database:

Package Downloads
Naravel.Database.Sqlite

SQLite driver for Naravel.Database, built on Microsoft.Data.Sqlite.

Naravel.Database.Postgres

PostgreSQL driver for Naravel.Database, built on Npgsql.

Naravel.Database.SqlServer

SQL Server driver for Naravel.Database, built on Microsoft.Data.SqlClient.

Naravel.Database.MySql

MySQL driver for Naravel.Database, built on MySqlConnector.

Naravel.Database.EntityFrameworkCore

EF Core interop for Naravel.Database: a DbContext and the query builder share one connection and one transaction.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.2.0 327 11/13/2026
0.1.1 154 11/2/2026
0.1.0 156 11/1/2026