Namh.Data.DynamicSql
1.0.0
See the version list below for details.
dotnet add package Namh.Data.DynamicSql --version 1.0.0
NuGet\Install-Package Namh.Data.DynamicSql -Version 1.0.0
<PackageReference Include="Namh.Data.DynamicSql" Version="1.0.0" />
<PackageVersion Include="Namh.Data.DynamicSql" Version="1.0.0" />
<PackageReference Include="Namh.Data.DynamicSql" />
paket add Namh.Data.DynamicSql --version 1.0.0
#r "nuget: Namh.Data.DynamicSql, 1.0.0"
#:package Namh.Data.DynamicSql@1.0.0
#addin nuget:?package=Namh.Data.DynamicSql&version=1.0.0
#tool nuget:?package=Namh.Data.DynamicSql&version=1.0.0
dynamic-sql
Build powerful database screens without creating a CLR class for every table.
dynamic-sql turns runtime metadata, C# expressions, or YAML definitions into
safe, provider-specific SQL. The same query engine can power a data grid,
report builder, admin screen, or API endpoint even when the fields and
relationships are selected at runtime.
A query defined by data
var rows = db.QueryYml("""
Entity: User
Projection:
- Name
- Manager.Name | Manager-Name
Filter: "[Name] like 'Dav%' && [Age] >= 18"
Sorts: Manager.Name DESC
Page: 1
PageSize: 50
""").ToList();
No generated entity class. No hand-written join. No string-built SQL.
The same metadata can be queried from C#:
var rows = db.Query("User")
.Where(user => user["Age"] >= 18)
.Select("Name", "Manager.Name")
.ToList();
Why it is different
- Runtime entities, fields, relationships, and aggregates.
- One compiler for C# expressions and YAML queries.
- Relationship paths such as
Manager.NameandMembers.Name. - Dynamic projections and aliases without CLR models.
- SQL Server, SQLite, and PostgreSQL dialect support.
- Parameterized filters and executable SQL diagnostics.
- A dialect-independent SQL expression intermediate representation.
var sql = db.QueryYml(yml).ToSql();
Console.WriteLine(sql.CommandText);
For SQL Server, the diagnostic output includes typed DECLARE statements, so
the complete text can be copied directly into a query window.
Start here
- Read the user manual for installation, metadata, queries, YAML, providers, async APIs, and troubleshooting.
- Read the technical guide for the compiler pipeline and important classes.
- See the query model reference for the canonical backend JSON format for projections and query contexts.
Targets: .NET 8, .NET 9, and .NET 10.
Run the demo
Install the .NET 10 SDK, Node.js with npm, and Windows Terminal, then run this from the repository root in PowerShell:
.\start.ps1
The script installs frontend dependencies on first run, then opens the API and frontend in separate, titled Windows Terminal tabs, in that order. The API's Swagger UI is at http://localhost:21210/swagger; the frontend is at http://localhost:5173.
The demo backend is split into four projects: Demo.WebApi hosts the API and
registers dependencies, Demo.Services contains application logic,
Demo.Contracts defines service and repository abstractions, and
Demo.Repositories implements file, in-memory, and database access. Set
StorageProvider in src/Demo.WebApi/appsettings.json to Files (default) or
Memory to select the metadata, function-definition, and report store. Reports
are exposed through the /report API. Built-in metadata and SQL functions are
shared, read-only definitions; built-in reports are loaded from the existing
query-request storage folder
src/Demo.WebApi/FileStorage/QueryRequests/*.yml and can be edited and run but
not saved or deleted. Custom metadata, functions, and reports are stored
under FileStorage/UserData/{SectionId}/ and are isolated by section.
Database connections remain selected separately through DbServerType.
The IQueryRequestRepository stores QueryDefinition YAML files in
FileStorage/QueryRequests for built-ins and
FileStorage/UserData/{SectionId}/QueryRequests for custom requests. These
files use the flat QueryDefinition YAML shape (for example, Entity and
Fields are top-level properties).
License
MIT License. See MANUAL.md for the full license text.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. 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. |
-
net10.0
- YamlDotNet (>= 16.3.0)
-
net8.0
- YamlDotNet (>= 16.3.0)
-
net9.0
- YamlDotNet (>= 16.3.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.