Introduction
The MuchAdo class library provides an intuitive API for working with relational databases like MySQL, PostgreSQL, SQLite, and Microsoft SQL Server. It is similar to Dapper and other micro ORMs for .NET.
var shortWidgets = await connector
.CommandFormat(
$"select id, name from widgets where height <= {maxHeight}")
.QueryAsync<(long Id, string Name)>(cancellationToken);
To use MuchAdo, add a reference to the NuGet package that corresponds to your database. Strongly consider adding a reference to MuchAdo.Analyzers as well.
Key Features
Follow the links below for detailed information on MuchAdo features.
- Databases — Work with ADO.NET providers, including provider-specific packages and connector classes for MySQL, PostgreSQL, SQLite, and Microsoft SQL Server.
- Connections — Create and dispose connectors, open and close connections automatically, and configure connector settings.
- Commands — Execute SQL and stored procedures, read records with query and enumeration methods, set command timeouts, cancel commands, and handle execution events.
- Command Batches — Execute multiple SQL statements in one database call, read multiple result sets, and build batches incrementally.
- Transactions — Run manual and automatic transactions, configure transaction settings, roll back uncommitted work, and attach existing transactions.
- Data Mapping — Map data records to strings, value types, enums, blobs, DTOs, tuples, dynamic objects, dictionaries, custom mappers, and mapping delegates.
- Formatted SQL — Build SQL from interpolated fragments and parameter values, including raw SQL, quoted names, concatenation helpers, lists, tuples, clauses, and SQL keyword helpers.
- Parameters — Inject parameters safely, expand collection parameters, use named and unnamed parameter sources, generate DTO-based parameters, create
LIKEparameters, set parameter types, and combine parameter sources. - Resilience — Retry opening connections, running transactions, executing commands or command batches, and wrapping arbitrary idempotent actions.
- Optimizations — Improve performance with prepared commands, cached commands, and connector pooling.
- Analyzers — Add analyzer warnings for potentially incorrect library usage, such as interpolated strings passed to
Command. - Other Libraries — Compare MuchAdo with Dapper across connection handling, query buffering, command batching, transaction tracking, mapping, SQL building, parameters, and optimizations.