Skip to content
Marcus Ackre Medina edited this page Sep 13, 2026 · 4 revisions

MarcusMedina.Fluent.Data.Sql

Fluent SQL query builder — build parameterized SQL strings in a readable, chainable API.

dotnet add package MarcusMedina.Fluent.Data.Sql

Why this exists

This came from watching my students struggle with writing SQL by hand. I designed this to help them along the way — though, cheekily, before the course ended they still had to wrestle with raw query strings anyway.

In this case, I wanted a builder that produces the exact same parameterised SQL a student would eventually have to write themselves, so it doubles as a way to check your own work.

Who this is for

  • New to SQL? Build queries step by step and read back the exact parameterised SQL you'll eventually need to write by hand — a safe way to check your own work.
  • Professional? Dynamic query building for data-access layers where a full ORM is more than you need, with parameterisation baked in so SQL injection isn't something you have to remember to prevent.

Pages

Quick Example

using MarcusMedina.Fluent.Data.Sql;

var sql = new Sql(DatabaseType.PostgreSQL)
    .Table("users")
    .Select("name", "age")
    .When("age > 18")
    .OrderBy("name")
    .Build();
// SELECT "name", "age" FROM "users" WHERE age > 18 ORDER BY "name" ASC;

Links

Clone this wiki locally