Techjrstar.MySqlDbHelper 1.1.1

dotnet add package Techjrstar.MySqlDbHelper --version 1.1.1
                    
NuGet\Install-Package Techjrstar.MySqlDbHelper -Version 1.1.1
                    
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="Techjrstar.MySqlDbHelper" Version="1.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Techjrstar.MySqlDbHelper" Version="1.1.1" />
                    
Directory.Packages.props
<PackageReference Include="Techjrstar.MySqlDbHelper" />
                    
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 Techjrstar.MySqlDbHelper --version 1.1.1
                    
#r "nuget: Techjrstar.MySqlDbHelper, 1.1.1"
                    
#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 Techjrstar.MySqlDbHelper@1.1.1
                    
#: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=Techjrstar.MySqlDbHelper&version=1.1.1
                    
Install as a Cake Addin
#tool nuget:?package=Techjrstar.MySqlDbHelper&version=1.1.1
                    
Install as a Cake Tool

Techjrstar.MySqlDbHelper

Techjrstar.MySqlDbHelper is a library that simplifies the execution of stored procedures in MySQL databases using C#.

Installation

You can install this library via NuGet:

Usage

Here's how you can use the library to execute a stored procedure:

using Techjrstar.MySqlDbHelper;

// Create a DbHelper instance 
var connectionString = "Server=myServer;Database=myDB;User=myUser;Password=myPassword;";
var dbHelper = new DbHelper(connectionString);

// Define stored procedure parameters
var parameters = new Dictionary<string, object>
{
    { "@_param1", "value1" },
    { "@_param2", 123 },
   
};

// Execute the store procedute
var result = await dbHelper.ExecuteProcedureAsync("procedure_name", parameters);

// process the results

foreach (var row in result)
{
    Console.WriteLine($"Field1: {row["Field1"]}, Field2: {row["Field2"]}");
}

// Execute query

var dbHelper = new DbHelper(connectionString);
var query = "SELECT * FROM vw_view_name";
var result = await dbHelper.ExecuteQueryAsync(query);

// Execute QueryNoAsync

string insertQuery = $"INSERT INTO {tableName} (nombre, edad) VALUES ('Juan', 30)";
int rowsAffected = await dbHelper.ExecuteNonQueryAsync(insertQuery);

if (rowsAffected > 0)
{
    Console.WriteLine("Successful Operation");
}
else
{
    Console.WriteLine("No rows were affected.");
}

// With Parameters

string query = "UPDATE products SET price = @price WHERE id = @id";

var parameters = new Dictionary<string, object>
{
    { "@price", 19.99 },
    { "@id", 5 }
};

int rowsAffected = await ExecuteNonQueryAsync(query, parameters);

Console.WriteLine($"Rows affected: {rowsAffected}");

// With CancellationToken

using CancellationTokenSource cts = new CancellationTokenSource();
CancellationToken token = cts.Token;

string query = "INSERT INTO orders (customer_id, total) VALUES (@customerId, @total)";

var parameters = new Dictionary<string, object>
{
    { "@customerId", 123 },
    { "@total", 150.75 }
};

// Start a task in another thread to cancel after 1 second (example)
Task.Run(async () =>
{
    await Task.Delay(1000);
    cts.Cancel(); // Cancel the operation
});

try
{
    int result = await ExecuteNonQueryAsync(query, parameters, token);
    Console.WriteLine($"Rows inserted: {result}");
}
catch (OperationCanceledException)
{
    Console.WriteLine("The operation was canceled.");
}

New function added ExecuteProcedureWithTypedParametersAsync
Product Compatible and additional computed target framework versions.
.NET 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.1.1 131 9/2/2026
1.1.0 391 2/7/2026
1.0.9 318 12/18/2025
1.0.8 375 8/12/2025
1.0.7 349 3/11/2025
1.0.6 221 3/11/2025
1.0.5 230 3/11/2025
1.0.4 191 2/17/2025
1.0.3 246 10/28/2024
1.0.2 184 10/22/2024
1.0.1 164 10/16/2024
1.0.0 157 10/16/2024