EricksonLopez.SqlBuilder

dotnet-sql-builder · Querying & Data

On this page (20 sections)

1. Identity, Tier & Maturity Profile#

L3 Persistence & IntegrationsStableMaintenance: ActiveAOT: PartialMIT LicenseConfidence: HIGH
Infrastructurenet8.0net9.0net10.0

2. Value Proposition & Problem Solved#

Immutable, Native AOT-first SQL query builder and high-performance execution ecosystem for .NET 8, 9 & 10. Features type-safe AST compilation, zero-reflection source generators, Roslyn analyzers, and dialect compilers for PostgreSQL, SQL Server, MySQL, MariaDB, SQLite, and Oracle.

Heavy ORMs add change-tracking overhead and unpredictable LINQ translation, while raw concatenated SQL strings lack refactoring safety and risk SQL injection.

3. Quick Install#

Primary package: EricksonLopez.SqlBuilder

dotnet add package EricksonLopez.SqlBuilder --version 2.0.0
Also published in this family:
EricksonLopez.SqlBuilder.AbstractionsEricksonLopez.SqlBuilder.SqliteEricksonLopez.SqlBuilder.PostgreSqlEricksonLopez.SqlBuilder.MySqlEricksonLopez.SqlBuilder.OracleEricksonLopez.SqlBuilder.SqlServer

4. Verified Ecosystem Metrics#

v2.0.0
NuGet Published Version
v3.0.0
Repo HEAD Version
6,827
NuGet Downloads
16
Packable Packages
1,452
Public API Members
3
Benchmark Rows (RyuJIT)

Snapshot retrieved UTC: 2026-12-01

5. When to Use & When Not to Use#

When to use

  • You want immutable SQL AST query builders (SelectQuery<T>, InsertQuery<T>, UpdateQuery<T>, DeleteQuery<T>) compiled across 6 database dialects.

When NOT to use

  • You want domain-layer expression predicates (`Expression<Func<T, bool>>`)—use EricksonLopez.Specification.

6. Core Capabilities & Design Invariants#

Immutable AST & Roslyn Generators

Record-based query composition with CTEs, window functions, LATERAL joins, and compile-time [SqlEntity] metadata.

6 Dialect Compilers & Analyzers

Pay-for-play packages for PostgreSQL, SQL Server, MySQL, MariaDB, SQLite, and Oracle plus SQL safety analyzers.

7. Included NuGet Packages & Adapters#

Package IDStatusNuGet / LocalTFMsAOT StatusDownloadsDescription
EricksonLopez.SqlBuilderPrimaryPublishedv2.0.0 / v3.0.0net8.0, net9.0, net10.0AOT: Full1,126Immutable NativeAOT-friendly SQL Builder core — AST, query builders, expression visitors, and dialect compilation contracts.
EricksonLopez.SqlBuilder.AbstractionsPublishedv2.0.0 / v3.0.0net8.0, net9.0, net10.0AOT: Full1,312Contracts, interfaces, and AST node definitions for EricksonLopez.SqlBuilder.
EricksonLopez.SqlBuilder.SqlitePublishedv2.0.0 / v3.0.0net8.0, net9.0, net10.0AOT: Full862Package Description
EricksonLopez.SqlBuilder.PostgreSqlPublishedv2.0.0 / v3.0.0net8.0, net9.0, net10.0AOT: Full385AOT-compatible AST compiler for the PostgreSQL dialect with LATERAL joins, materialized CTEs, and window function FILTER support.
EricksonLopez.SqlBuilder.MySqlPublishedv2.0.0 / v3.0.0net8.0, net9.0, net10.0AOT: Full332Package Description
EricksonLopez.SqlBuilder.OraclePublishedv2.0.0 / v3.0.0net8.0, net9.0, net10.0AOT: Incompatible309Package Description
EricksonLopez.SqlBuilder.SqlServerPublishedv2.0.0 / v3.0.0net8.0, net9.0, net10.0AOT: Full294Package Description
EricksonLopez.SqlBuilder.TestingPublishedv2.0.0 / v3.0.0net8.0, net9.0, net10.0AOT: Incompatible281Package Description
EricksonLopez.SqlBuilder.OpenTelemetryPublishedv2.0.0 / v3.0.0net8.0, net9.0, net10.0AOT: Full280Package Description
EricksonLopez.SqlBuilder.MariaDbPublishedv2.0.0 / v3.0.0net8.0, net9.0, net10.0AOT: Full276Package Description
EricksonLopez.SqlBuilder.DapperPublishedv2.0.0 / v3.0.0net8.0, net9.0, net10.0AOT: Incompatible259Seamless integration with Dapper and OpenTelemetry for EricksonLopez.SqlBuilder.
EricksonLopez.SqlBuilder.PaginationPublishedv2.0.0 / v3.0.0net8.0, net9.0, net10.0AOT: Full219Pagination integration for EricksonLopez.SqlBuilder. Provides offset and keyset cursor pagination extension methods for SelectQuery AST.
EricksonLopez.SqlBuilder.AotPublishedv2.0.0 / v3.0.0net8.0, net9.0, net10.0AOT: Full173Reflection-free, NativeAOT-compatible query execution layer for EricksonLopez.SqlBuilder. Executes compiled SQL directly over IDbConnection using source-generated entity mappers, with no runtime code generation and no dependency on Dapper.
EricksonLopez.SqlBuilder.Dapper.AotPublishedv2.0.0 / v3.0.0net8.0, net9.0, net10.0AOT: Full162Dapper.AOT and NativeAOT reflection-free execution extensions for EricksonLopez.SqlBuilder. Provides strongly-typed, allocation-free SQL query execution over DbConnection without runtime code generation.
EricksonLopez.SqlBuilder.SourceGeneratorsAnalyzer / GeneratorPublishedv2.0.0 / v3.0.0netstandard2.0AOT: N/A (Analyzer/Legacy)280Roslyn analyzers and AOT source generators for EricksonLopez.SqlBuilder.
EricksonLopez.SqlBuilder.AnalyzersAnalyzer / GeneratorPublishedv2.0.0 / v3.0.0netstandard2.0AOT: N/A (Analyzer/Legacy)277Roslyn Analyzers for EricksonLopez.SqlBuilder.

8. Quick Start Code Example#

Grounded in verified public APIs from EricksonLopez.SqlBuilder. Compile with `<ImplicitUsings>disable</ImplicitUsings>` and explicit imports.

using System;
using EricksonLopez.SqlBuilder.Annotations;

[SqlEntity("users")]
public partial class UserRecord
{
    [DatabaseGenerated]
    public int Id { get; set; }
    public string Name { get; set; } = string.Empty;
    public string Email { get; set; } = string.Empty;
    public bool IsActive { get; set; }
}

9. Architecture & Dependency Flow#

flowchart LR
  lib_sql_builder["EricksonLopez.SqlBuilder (L3)"]
  lib_result["EricksonLopez.Result (L0)"]
  lib_sql_builder --> lib_result
  lib_pagination["EricksonLopez.Pagination (L2)"]
  lib_sql_builder -.-> lib_pagination
  lib_dapper_extensions["EricksonLopez.DapperExtensions (L3)"]
  lib_dapper_extensions -.-> lib_sql_builder
EricksonLopez.SqlBuilder Dependency Topology2 upstream library dependencies and 1 downstream dependent libraries verified in dependencies.json.
View accessible text summary and structure

2 upstream library dependencies and 1 downstream dependent libraries verified in dependencies.json.

DirectionLibraryTierRelationship Kinds
UpstreamEricksonLopez.ResultL0Compile-Time, NuGet Package
UpstreamEricksonLopez.PaginationL2Adapter, NuGet Package
DownstreamEricksonLopez.DapperExtensionsL3Adapter, NuGet Package
flowchart LR
  lib_sql_builder["EricksonLopez.SqlBuilder (L3)"]
  lib_result["EricksonLopez.Result (L0)"]
  lib_sql_builder --> lib_result
  lib_pagination["EricksonLopez.Pagination (L2)"]
  lib_sql_builder -.-> lib_pagination
  lib_dapper_extensions["EricksonLopez.DapperExtensions (L3)"]
  lib_dapper_extensions -.-> lib_sql_builder

10. Target Frameworks & Native AOT / Trimming Matrix#

MSBuild `.csproj` inspection across 16 packages: 11 Full, 0 Partial, 3 Incompatible, 2 NotApplicable (analyzers/generators).

Package IDIsAotCompatibleEnableTrimAnalyzerVerified AOT StatusTarget Frameworks
EricksonLopez.SqlBuildertruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.SqlBuilder.AbstractionstruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.SqlBuilder.SqlitetruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.SqlBuilder.PostgreSqltruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.SqlBuilder.MySqltruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.SqlBuilder.OraclefalsetrueIncompatiblenet8.0, net9.0, net10.0
EricksonLopez.SqlBuilder.SqlServertruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.SqlBuilder.TestingfalsefalseIncompatiblenet8.0, net9.0, net10.0
EricksonLopez.SqlBuilder.OpenTelemetrytruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.SqlBuilder.MariaDbtruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.SqlBuilder.DapperfalsefalseIncompatiblenet8.0, net9.0, net10.0
EricksonLopez.SqlBuilder.PaginationtruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.SqlBuilder.AottruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.SqlBuilder.Dapper.AottruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.SqlBuilder.SourceGeneratorsnullnullNotApplicablenetstandard2.0
EricksonLopez.SqlBuilder.AnalyzersnullnullNotApplicablenetstandard2.0

11. Upstream Dependencies & Downstream Dependents#

Upstream Dependencies (2)

Downstream Dependents (1)

12. Optional Adapters & Third-Party Integrations#

Internal Adapter Edges & Integration Packages

Verified External NuGet Dependencies (22)

AwesomeAssertionsBogusDapperMicrosoft.CodeAnalysis.CSharpMicrosoft.CodeAnalysis.CSharp.WorkspacesMicrosoft.Data.SqlClientMicrosoft.Data.SqliteMicrosoft.Extensions.Logging.AbstractionsMicrosoft.Extensions.ObjectPoolMySqlConnectorNpgsqlOpenTelemetry.ApiOracle.ManagedDataAccess.CoreSQLitePCLRaw.lib.e_sqlite3SSH.NETSystem.Collections.ImmutableTestcontainers.MsSqlTestcontainers.MySqlTestcontainers.OracleTestcontainers.PostgreSqlVerify.Xunitxunit

13. Configuration & DI Registration Summary#

Verified DI & Configuration Entry Points

  • DeleteQuery<T>.AddNode

    Appends the specified node to the query AST.

  • InsertQuery<T>.AddNode

    Appends the specified node to the query AST.

  • SelectQuery<T>.AddNode

    Appends the specified node to the query AST.

  • UpdateQuery<T>.AddNode

    Appends the specified node to the query AST.

  • IParameterManager.AddNamed

    Adds a named parameter value and returns its formatted parameter name in the dialect's syntax.

  • InsertBuilder<T>.AddRule

    Adds a custom column selection rule to the insert operation.

  • UpdateBuilder<T>.AddRule

    Adds a custom column selection rule to the update operation.

  • OracleParameterManager.AddNamed

    Adds a named parameter value and returns its formatted parameter name in the dialect's syntax.

Key Public Types & Contracts

  • EricksonLopez.SqlBuilder.AotSqlRendererBase (class)

    Provides a base implementation for an AOT-compatible SQL renderer that generates SQL statements using pooled `Text.StringBuilder` buffers (pool-rented, not allocation-free for SQL assembly) and zero-allocation data materialization for the `IDataReader → T` hot path.

  • EricksonLopez.SqlBuilder.CursorPaginationExtensions (class)

    Provides extension methods for implementing keyset (cursor-based) pagination.

  • EricksonLopez.SqlBuilder.DeleteQuery`1 (record)

    Represents a DELETE query syntax tree builder for the specified entity type.

  • EricksonLopez.SqlBuilder.DiffUpdateExtensions (class)

    Provides extension methods for generating UPDATE statements based on entity state differences.

  • EricksonLopez.SqlBuilder.DynamicSortingExtensions (class)

    Provides extension methods for applying dynamic sorting to queries using string-based column names.

  • EricksonLopez.SqlBuilder.InsertQuery`1 (record)

    Represents an INSERT query syntax tree builder for the specified entity type.

  • EricksonLopez.SqlBuilder.Param (class)

    Provides factory methods for creating explicitly typed SQL parameters.

  • EricksonLopez.SqlBuilder.QueryContract (record)

    Represents the verifiable shape of a compiled query.

  • EricksonLopez.SqlBuilder.QueryContractExtensions (class)

    Provides extension methods for generating query contracts.

  • EricksonLopez.SqlBuilder.RawQuery (record)

    Represents a raw SQL query that is always fully parameterized. Unlike Dapper's raw string approach, `RawQuery` never accepts string concatenation and enforces NativeAOT-safe parameter passing.

  • EricksonLopez.SqlBuilder.SelectQuery`1 (record)

    Represents a SELECT query syntax tree builder for the specified entity type.

  • EricksonLopez.SqlBuilder.Sql (class)

    Provides entry points and static factory methods for constructing type-safe SQL queries.

14. Verified Performance Benchmarks#

All verified measurements below come strictly from `BenchmarkDotNet.Artifacts` running on .NET RyuJIT (0 NativeAOT benchmark runs exist in this snapshot).

Total rows: 3 · Measured: 3 · NA / Error: 0 · Suites: 1

Observed runtimes: .NET 10.0.11 X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI

Observed CPUs: Unknown processor

SuiteMethodRuntimeMean (ns)Allocated (B)Status
SelectBenchmarksSqlBuilder_SimpleSelect.NET 10.0.11 X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI5441,966measured
SelectBenchmarksSqlBuilder_ComplexSelect.NET 10.0.11 X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI1,305.33,738measured
SelectBenchmarksSqlBuilder_GroupBy.NET 10.0.11 X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI1,567.22,478measured

15. Release History & NuGet vs Repo Status#

Version lag detected: NuGet.org latest published version is v2.0.0, while local repository HEAD is at v3.0.0.

VersionSourcePublished DateSummary
v2.0.0 ↗nuget2026-09-24Published EricksonLopez.SqlBuilder 2.0.0 to NuGet.org.
v2.0.0 ↗github2026-09-24[2.0.0](https://github.com/ericksonlopezf/dotnet-sql-builder/compare/v1.0.0...v2.0.0) (2026-09-24) ⚠ BREAKING CHANGES * implement security invariants, AST validation, and dialect enhancements ✨ Features * implement security invariants, AST validation, and dialect enhancements ([d6bc61a](https://github.com/ericksonlopezf/dotnet-sql-builder/commit/d6bc61a2dc9d6ade2e0828f9ebfab813fd217325))
v1.0.0 ↗github2026-08-29Ecosystem Packages in this release | Package | Version | |---------|---------| | `EricksonLopez.SqlBuilder.Abstractions` | `1.0.0` | | `EricksonLopez.SqlBuilder` | `1.0.0` | | `EricksonLopez.SqlBuilder.Aot` | `1.0.0` | | `EricksonLopez.SqlBuilder.Analyzers` | `1.0.0` | | `EricksonLopez.SqlBuilder.Dapper` | `1.0.0` | | `EricksonLopez.SqlBuilder.Dapper.Aot` | `1.0.0` | | `EricksonLopez.SqlBuilder...
v1.0.0 ↗nuget2026-08-29Published EricksonLopez.SqlBuilder 1.0.0 to NuGet.org.

Libraries in the same tier, architectural layer, or directly paired via dependency edges.

17. Documentation, API Reference & Portal Links#

Per-library conceptual Starlight pages expand in M4; API Reference pages expand in M3.2.

18. Source Repository, License & Contributing#

Released under the MIT License. All assemblies follow EricksonLopez.* build invariants: explicit imports, strong-name signing (`EricksonLopez.snk`), and ASCII author metadata (`Erickson Lopez`).

19. Troubleshooting, Pitfalls & Migration Guidance#

  • Core, Dapper.Aot, and 5 dialect compilers are Full AOT; SqlBuilder.Dapper, SqlBuilder.Oracle, and SqlBuilder.Testing declare IsAotCompatible=false.
  • Version lag detected: NuGet.org latest published version is v2.0.0, while local repository HEAD is at v3.0.0.

20. Quality & Verification Evidence#

Strong-Name Signing (`EricksonLopez.snk`)
EricksonLopez.snk
`ImplicitUsings=disable`
disable
XML Documentation Extraction
Verified (34 namespaces, 244 types, 1452 members)
MSBuild AOT / Trim Attributes
11 Full / 0 Partial / 3 Incompatible / 2 N/A
BenchmarkDotNet Artifacts
3 total (3 measured, 0 na_error)

Explicit Verification Boundaries & Limitations

  • All verified measurements below come strictly from `BenchmarkDotNet.Artifacts` running on .NET RyuJIT (0 NativeAOT benchmark runs exist in this snapshot).

Search EricksonLopez.* Ecosystem

Type a library name, NuGet package ID, .NET type, or architectural concept to search across the portal.