Skip to main content
net8.0net9.0.NETStandard2.0

A fluent, powerful, efficient library for querying with MySqlConnector.

Published
May 11, 2025
1y ago
Total Downloads
16.5K
16,498

Install

dotnet add package MuchAdo.MySql --version 0.0.6
ProductVersions
.NET
net8.0net9.0
.NET Standard
netstandard2.0

README

MuchAdo

A fluent, powerful, efficient library for querying ADO.NET databases.

Build

Quick Start

The MuchAdo class library provides an intuitive API for working with ADO.NET providers like those for MySQL, PostgreSQL, Microsoft SQL Server, and SQLite. It is similar to Dapper and other micro ORMs for .NET.

To use this library, add a reference to the MuchAdo NuGet package that corresponds to your ADO.NET provider. Then create a connection to your database and use it to construct a MuchAdo connector.

ADO.NET Provider MuchAdo Package MuchAdo Connector
MySqlConnector MuchAdo.MySql MySqlDbConnector
Npgsql MuchAdo.Npgsql NpgsqlDbConnector
Microsoft.Data.Sqlite MuchAdo.Sqlite SqliteDbConnector
Microsoft.Data.SqlClient MuchAdo DbConnector
any ADO.NET provider MuchAdo DbConnector

Here's a simple code sample that opens an in-memory SQLite database, creates a table, inserts a few rows within a transaction, and runs a couple of queries. The example uses synchronous methods, which are appropriate for SQLite, but every synchronous method has an equivalent asynchronous method, e.g. ExecuteAsync. There's no risk of SQL injection attacks with the interpolated strings, which use formatted SQL. Try it!

using var connector = new SqliteDbConnector(
    new SqliteConnection("Data Source=:memory:"));

connector
    .Command("""
        create table widgets (
            id integer primary key autoincrement,
            name text not null,
            height real not null)
        """)
    .Execute();

var widgets = new[]
{
    new Widget("First", 6.875),
    new Widget("Second", 1.414),
    new Widget("Third", 3.1415),
};

using (connector.BeginTransaction())
{
    foreach (var widget in widgets)
    {
        connector
            .CommandFormat($"""
                insert into widgets (name, height)
                values ({widget.Name}, {widget.Height})
                """)
            .Execute();
    }

    connector.CommitTransaction();
}

var maxHeight = 5.0;
foreach (var widget in connector
    .CommandFormat($"""
        select name, height
        from widgets
        where height <= {maxHeight}
        """)
    .Query<Widget>())
{
    Console.WriteLine($"short: {widget}");
}

var (min, max) = connector
    .Command("select min(height), max(height) from widgets")
    .QuerySingle<(double, double)>();
Console.WriteLine($"min height {min}, max height {max}");

Changes from Previous Version

No structural changes between v0.0.5 and v0.0.6.

Adoption Assessment

Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.

Compatibility metadata lists 3 target frameworks; confirm the exact target used by your application.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.