jaytwo.Ergonomics.Ado 0.1.0-beta-20251221223908

This is a prerelease version of jaytwo.Ergonomics.Ado.
dotnet add package jaytwo.Ergonomics.Ado --version 0.1.0-beta-20251221223908
                    
NuGet\Install-Package jaytwo.Ergonomics.Ado -Version 0.1.0-beta-20251221223908
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="jaytwo.Ergonomics.Ado" Version="0.1.0-beta-20251221223908" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="jaytwo.Ergonomics.Ado" Version="0.1.0-beta-20251221223908" />
                    
Directory.Packages.props
<PackageReference Include="jaytwo.Ergonomics.Ado" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add jaytwo.Ergonomics.Ado --version 0.1.0-beta-20251221223908
                    
#r "nuget: jaytwo.Ergonomics.Ado, 0.1.0-beta-20251221223908"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package jaytwo.Ergonomics.Ado@0.1.0-beta-20251221223908
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=jaytwo.Ergonomics.Ado&version=0.1.0-beta-20251221223908&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=jaytwo.Ergonomics.Ado&version=0.1.0-beta-20251221223908&prerelease
                    
Install as a Cake Tool

jaytwo.Ergonomics.Ado

Transparent ergonomic extensions for base ADO.NET objects.

NuGet Version NuGet Downloads License: MIT

Overview

It's not an ORM. It doesn't make any inferences or assumptions. It simply provides ergonomic extension methods for ADO.NET objects to reduce boilerplate code.

ExecuteScalar/ExecuteScalarAsync

Old Way

await using var connection = new SqlConnection(connectionString);
await using var command = connection.CreateCommand();
command.CommandText = "SELECT COUNT(*) FROM orders WHERE customer_id = @customer_id";

var orderIdParam = command.CreateParameter();
command.Parameters.Add(orderIdParam);
orderIdParam.ParameterName = "@customer_id";
orderIdParam.Value = 1234;

await connection.OpenAsync(cancellationToken);
var valueObj = await command.ExecuteScalarAsync(cancellationToken);

return Convert.ToInt32(valueObj);

New Way

return await _connectionFactory.ExecuteScalarAsync<int>(
    command => command
        .WithCommandText("SELECT COUNT(*) FROM orders WHERE customer_id = @customer_id")
        .WithParameter("@customer_id", 1234),
    cancellationToken);

ExecuteReader/ExecuteReaderAsync

Old Way

await using var connection = new SqlConnection(_connectionString);
await using var command = connection.CreateCommand();
command.CommandText = "SELECT first_name, last_name FROM customers WHERE is_active = @is_active";

var orderIdParam = command.CreateParameter();
command.Parameters.Add(orderIdParam);
orderIdParam.ParameterName = "@is_active";
orderIdParam.Value = true;

await connection.OpenAsync(cancellationToken);
await using var reader = await command.ExecuteReaderAsync(cancellationToken);

var customers = new List<Customer>();
while (await reader.ReadAsync(cancellationToken))
{
    customers.Add(new Customer(FirstName: reader.GetString("first_name"), LastName: reader.GetString("last_name")));
}

return customers;

New Way

return await _connectionFactory.ExecuteReadAllAsync(
    command => command
        .WithCommandText("SELECT first_name, last_name FROM customers WHERE is_active = @is_active")
        .WithParameter("@is_active", true),
    reader => new Customer(FirstName: reader.GetString("first_name"), LastName: reader.GetString("last_name")),
    cancellationToken);

Made with ♥ by Jake — Licensed under the MIT License

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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 was computed.  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 was computed.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on jaytwo.Ergonomics.Ado:

Package Downloads
jaytwo.DistributedLocks

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0-beta-20251221223908 142 12/22/2025
0.1.0-beta-20251127234842 134 11/28/2025
0.1.0-beta-20251122005140 206 11/22/2025
0.1.0-beta-20251116072729 208 11/16/2025
0.1.0-beta-20251116000919 207 11/16/2025
0.1.0-beta-20251114021540 220 11/14/2025
0.1.0-beta-20251113232733 228 11/14/2025
0.1.0-beta-20251112201650 270 11/13/2025