MySqlOptimizer 1.3.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package MySqlOptimizer --version 1.3.0
                    
NuGet\Install-Package MySqlOptimizer -Version 1.3.0
                    
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="MySqlOptimizer" Version="1.3.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MySqlOptimizer" Version="1.3.0" />
                    
Directory.Packages.props
<PackageReference Include="MySqlOptimizer" />
                    
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 MySqlOptimizer --version 1.3.0
                    
#r "nuget: MySqlOptimizer, 1.3.0"
                    
#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 MySqlOptimizer@1.3.0
                    
#: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=MySqlOptimizer&version=1.3.0
                    
Install as a Cake Addin
#tool nuget:?package=MySqlOptimizer&version=1.3.0
                    
Install as a Cake Tool

MySqlOptimizer

Version 1.3

A simple and efficient C# library for performing common MySQL database operations. This library provides methods for executing queries, stored procedures, and managing database connections.

Features

  • Execute SQL Queries and Commands: Run SQL commands directly against the database.
  • Execute Stored Procedures with Parameters: Call stored procedures and pass parameters easily.
  • Execute Scalar Queries: Retrieve single values from the database.
  • Execute Data Readers with Parameters: Read data using a MySqlDataReader with parameters.
  • Check Database Connection Status: Verify if the database connection is successful.

Installation

You can install the package via NuGet Package Manager:

Install-Package MySqlOptimizer

Or using the .NET CLI:

dotnet add package MySqlOptimizer

Usage

  1. Check Database Connection

using MySqlOptimizer;

var mysql = new MysqlShort();

bool isConnected = mysql.CheckConnection("YourConnectionString");

  1. Execute a Scalar Query

using MySqlOptimizer;

var mysql = new MysqlShort();

object result = mysql.ExecuteScalar("YourConnectionString", "SELECT COUNT(*) FROM YourTable");

  1. Execute a Stored Procedure

using MySqlOptimizer; using System.Collections.Generic;

var mysql = new MysqlShort();

var parameters = new Dictionary<string, object> { { "@param1", value1 }, { "@param2", value2 } };

bool success = mysql.ExecuteStoredProcedure("YourConnectionString", "YourStoredProcedureName", parameters);

  1. Execute a Reader with Parameters

using MySqlOptimizer; using MySql.Data.MySqlClient;

var mysql = new MysqlShort();

var parameters = new MySqlParameter[] { new MySqlParameter("@param1", value1), new MySqlParameter("@param2", value2) };

using (MySqlDataReader reader = mysql.ExecuteReaderWithParameters("YourConnectionString", "SELECT * FROM YourTable WHERE Column1 = @param1", parameters)) { while (reader.Read()) { // Process each row } }

Exception Handling

The library throws exceptions for various error conditions. You can catch these exceptions to handle errors gracefully:

try { // Your database operation } catch (Exception ex) { Console.WriteLine(ex.Message); }

Contributing

Contributions are welcome! Please feel free to submit a pull request or create an issue if you find a bug or have a feature request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • MySQL Connector/NET
  • C# and .NET community
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 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.  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 (1)

Showing the top 1 NuGet packages that depend on MySqlOptimizer:

Package Downloads
MySqlCore

Single-class MySQL helper for .NET with ADO.NET, EF Core, async streaming, pagination, logging, bulk insert/upsert, and transactions.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.1.0 174 10/24/2025
1.4.0 456 7/21/2025
1.3.0 166 11/20/2024
1.2.0 151 11/20/2024
1.1.0 155 11/14/2024
1.0.0 154 11/14/2024