demapio 1.0.9

dotnet add package demapio --version 1.0.9
NuGet\Install-Package demapio -Version 1.0.9
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="demapio" Version="1.0.9" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add demapio --version 1.0.9
#r "nuget: demapio, 1.0.9"
#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.
// Install demapio as a Cake Addin
#addin nuget:?package=demapio&version=1.0.9

// Install demapio as a Cake Tool
#tool nuget:?package=demapio&version=1.0.9

Demapio

Small SQL mapper for C#

What?

It's like Dapper, but smaller and more focussed.

Why not just use Dapper?

If that works, do it. I keep having trouble with new versions of Dapper being 'smart' and re-writing my working SQL into broken SQL.

Demapio does a lot less, and aims to be small and stable rather than big and clever. No guarantees on speed.

Demapio deliberately uses unusual names for its extension methods, so it can be easily used alongside Dapper.

How?

Select a single value:

var conn = new NpgsqlConnection(ConnStr);

object? result = conn.QueryValue("SELECT ('Hello, ' || :para) as result;", new { para = "world" });

Query data to a list of C# objects:

var conn = new NpgsqlConnection(ConnStr);

var result = conn.SelectType<SamplePoco>("SELECT * FROM TestTable WHERE userId=:userId", new {userId = 10}).ToList()!;

Query data to a list of dynamic C# objects:

var conn = new NpgsqlConnection(ConnStr);

var result = conn.SelectDynamic("SELECT id, myValue FROM TestTable WHERE userId=:userId", new {userId = 10}).ToList()!;
Console.WriteLine(result.id, result.myValue);

Repeat a single statement with a batch of parameters:

var conn = new NpgsqlConnection(ConnStr);

conn.RepeatCommand("INSERT INTO TestTable (id, userId, deviceId) VALUES (:id, :userId, :deviceId);",
    new {id=1, userId=10, deviceId="User10 Phone"},
    new {id=2, userId=10, deviceId="User10 PC"},
    new {id=3, userId=20, deviceId="User20 Phone"},
    new {id=4, userId=20, deviceId="User20 Modem"}
);

Execute a statement, returning rows changed:

var conn = new NpgsqlConnection(ConnStr);

var changeCount = conn.CountCommand("UPDATE TestTable SET userId = :userId, deviceId = :deviceId WHERE id = :id;", new {id=1, userId=10, deviceId="User10 Phone"});
if (changeCount < 1) ...

Query data to an IDataReader:

var conn = new NpgsqlConnection(ConnStr);

using var result = conn.QueryReader("SELECT * FROM TestTable WHERE userId=:userId", new {userId = 10});
while (result.Read()) { ...
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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 was computed.  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. 
.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.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.9 124 3/28/2024
1.0.8 114 3/19/2024
1.0.7 166 3/5/2024
1.0.6 61 3/5/2024
1.0.5 260 10/24/2023
1.0.4 125 10/20/2023
1.0.3 148 8/31/2023
1.0.2 160 7/3/2023
1.0.1 137 6/29/2023
1.0.0 152 6/15/2023

Improvements to selecting bare enums