SharpCoreDB.Functional.Linq2DB
2.1.3
See the version list below for details.
dotnet add package SharpCoreDB.Functional.Linq2DB --version 2.1.3
NuGet\Install-Package SharpCoreDB.Functional.Linq2DB -Version 2.1.3
<PackageReference Include="SharpCoreDB.Functional.Linq2DB" Version="2.1.3" />
<PackageVersion Include="SharpCoreDB.Functional.Linq2DB" Version="2.1.3" />
<PackageReference Include="SharpCoreDB.Functional.Linq2DB" />
paket add SharpCoreDB.Functional.Linq2DB --version 2.1.3
#r "nuget: SharpCoreDB.Functional.Linq2DB, 2.1.3"
#:package SharpCoreDB.Functional.Linq2DB@2.1.3
#addin nuget:?package=SharpCoreDB.Functional.Linq2DB&version=2.1.3
#tool nuget:?package=SharpCoreDB.Functional.Linq2DB&version=2.1.3
SharpCoreDB.Functional.Linq2DB
linq2db adapter for SharpCoreDB.Functional.
Version: v1.9.5 (production-ready)
Package: SharpCoreDB.Functional.Linq2DB
Overview
SharpCoreDB.Functional.Linq2DB is the production-ready linq2db adapter for SharpCoreDB's functional stack. It delivers compile-time type safety, expressive LINQ, zero change-tracking overhead, and railway-oriented return types (Option<T>, Fin<T>, Seq<T>).
Perfect for:
- ✅ High-throughput AI/agentic workflows and GraphRAG
- ✅ Compile-time safe queries with full IntelliSense
- ✅ Low memory/CPU overhead (no EF-style tracking)
- ✅ Bulk operations via
BulkCopyAsync - ✅ Native AOT and .NET 11/C# 15
- ✅ Railway-oriented error handling (
Fin<T>)
Installation
dotnet add package SharpCoreDB.Functional.Linq2DB --version 2.0.0.0
Quick Start (Production)
1. Basic LINQ (raw linq2db)
using SharpCoreDB.Functional.Linq2DB;
using LinqToDB;
var conn = new SharpCoreDBDataConnection("Data Source=./app.scdb");
var users = await conn.GetTable<User>()
.Where(u => u.IsActive)
.OrderBy(u => u.Email)
.ToListAsync();
2. Functional API (recommended — Option/Fin/Seq)
var db = new FunctionalLinq2DbContext(conn);
// Option<T> for safe lookups
var user = await db.FindOneAsync<User>(u => u.Email == "test@example.com");
// Seq<T> for collections
var activeUsers = await db.QueryAsync<User>(u => u.IsActive);
// Fin<T> for mutations (railway-oriented)
var insertResult = await db.InsertBatchAsync(new[] { user1, user2 }); // uses BulkCopyAsync internally
insertResult.IfSucc(count => Console.WriteLine($"Inserted {count} rows"))
.IfFail(err => Console.WriteLine($"Error: {err.Message}"));
Connection note: Data Source=… and Path=… are both SharpCoreDB connection strings
(Data Source=./app.scdb;Password=…). See Storage and encryption below for what the adapter does with them.
Storage and encryption
The adapter is the SQLite dialect, not the SQLite engine:
- linq2db generates the SQL with its SQLite dialect — SharpCoreDB is SQLite-compatible at the SQL level.
- The SQL is executed on a
SharpCoreDBConnection(fromSharpCoreDB.Data.Provider), so the rows are stored by SharpCoreDB in its own file format and encrypted with AES-256-GCM when the connection string carries aPassword. - No SQLite file is created and the native
e_sqlite3library is never opened. Microsoft.Data.Sqlite remains a package dependency because linq2db's SQLite dialect resolves it for its provider plumbing;BulkCopyis set toMultipleRowsso the provider-specific native bulk-copy path is never taken.
This changed in 2.1.3: before that, SharpCoreDBDataConnection passed the connection string straight to
ProviderName.SQLite, so a password was refused ("the native SQLite library 'e_sqlite3' doesn't support
encryption") and the data landed in an unencrypted SQLite format 3 file that SharpCoreDB cannot read.
GetUnderlyingConnection() returns the SharpCoreDB ADO.NET connection, which is the way to run DDL or
SharpCoreDB-specific SQL that linq2db does not model.
Key Production Features
- BulkCopy support in
InsertBatchAsyncfor high-speed ingestion (GraphRAG, analytics) - Full type mapping (ULID as string, GUID as compact string, DateTime ISO, bool→int for SQLite compat)
- Transaction support with
TransactionAsync<TResult> - DeleteWhereAsync,
CountAsync,ExistsAsync,GetAllAsync - Seamless with SharpCoreDB.Functional (
Prelude,Option,Fin,Seq,Error) - Works alongside
SharpCoreDB.Functional.Dapperand EF Core functional wrapper
Documentation & Links
- Full API in
FunctionalLinq2DbContext.csandExtensions.cs - Test coverage:
tests/SharpCoreDB.Functional.Linq2DB.Tests/ - 🔗 SharpCoreDB GitHub
License: MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
-
net11.0
- linq2db (>= 6.5.1)
- Microsoft.Data.Sqlite (>= 10.0.14)
- Microsoft.Extensions.DependencyInjection (>= 10.0.14)
- Microsoft.Extensions.Logging (>= 10.0.14)
- Microsoft.Extensions.ObjectPool (>= 10.0.14)
- SharpCoreDB.Data.Provider (>= 2.1.3)
- SharpCoreDB.Functional (>= 2.1.3)
- SQLitePCLRaw.bundle_e_sqlite3 (>= 3.0.5)
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.4 | 69 | 11/13/2026 |
| 2.1.3 | 78 | 11/13/2026 |
| 2.1.2 | 120 | 10/26/2026 |
| 2.1.1 | 97 | 10/25/2026 |
| 2.1.0 | 122 | 10/10/2026 |
| 2.1.0-RC.3 | 72 | 9/17/2026 |
| 2.0.0.3 | 122 | 9/12/2026 |
| 2.0.0.2 | 155 | 9/4/2026 |
| 2.0.0.1 | 112 | 9/1/2026 |
| 2.0.0 | 117 | 9/1/2026 |
| 2.0.0-preview.3 | 92 | 8/30/2026 |
| 2.0.0-preview.2 | 99 | 8/30/2026 |
| 2.0.0-preview.1 | 90 | 8/29/2026 |
| 1.9.9 | 127 | 8/30/2026 |
| 1.9.8 | 118 | 8/29/2026 |
| 1.9.3 | 149 | 7/29/2026 |
v2.1.3 (2026-11-12): the linq2db adapter now executes on SharpCoreDB instead of SQLite, so a password is honoured and rows live in an encrypted SharpCoreDB file, and the SQL shapes that blocked it are fixed - pretty-printed INSERTs, SELECT-list projection, bare and negated boolean WHERE, LIKE with ESCAPE, scalar EXISTS, and hex byte[]/Guid literals. Previous: v2.1.2 (2026-10-26): patch release with no API changes - a bound text parameter is no longer re-scanned as SQL text, so a value holding an apostrophe, a doubled quote, a backslash, a comma or a parenthesis now round-trips exactly instead of landing in the neighbouring column or failing with "Mismatched parentheses in VALUES clause"; full detail in docs/CHANGELOG.md. Previous: v2.1.1 (2026-10-25): patch release with no API changes. A float[] parameter now reaches a VECTOR(n) column as a vector instead of the literal text "System.Single[]", and ORDER BY vec_distance_*() LIMIT k now reaches the vector index instead of a full scan. Previous: v2.1.0 (2026-10-10): net11.0-only (C# 15 preview) release line - 2,897 tests green across 16 suites; the fixed-width inline capacity ships at 16 by default on both storage paths (batched multi-row INSERT measured +12 to +19 percent); the overflow arena writes a row's payloads in one append instead of one file open per value; and in-place UPDATE/DELETE with deferred index maintenance put the fixed-width fair-PK layout ahead of SQLite on UPDATE (0.8x) and DELETE (0.5x). Full details: https://github.com/MPCoreDeveloper/SharpCoreDB/blob/master/docs/CHANGELOG.md