Delly.DBunny.MySql
2026.5.7
.NET 5.0
This package targets .NET 5.0. The package is compatible with this framework or higher.
.NET Standard 2.0
This package targets .NET Standard 2.0. The package is compatible with this framework or higher.
dotnet add package Delly.DBunny.MySql --version 2026.5.7
NuGet\Install-Package Delly.DBunny.MySql -Version 2026.5.7
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="Delly.DBunny.MySql" Version="2026.5.7" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Delly.DBunny.MySql" Version="2026.5.7" />
<PackageReference Include="Delly.DBunny.MySql" />
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 Delly.DBunny.MySql --version 2026.5.7
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Delly.DBunny.MySql, 2026.5.7"
#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 Delly.DBunny.MySql@2026.5.7
#: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=Delly.DBunny.MySql&version=2026.5.7
#tool nuget:?package=Delly.DBunny.MySql&version=2026.5.7
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Delly.DBunny.MySql
MySQL provider implementation for DBunny. Also compatible with MariaDB.
Installation
dotnet add package Delly.DBunny.MySql
Quick Start
using Delly.DBunny;
using Delly.DBunny.MySql;
using Delly.DBunny.Sql.Extension;
using Delly.DBunny.Connecting.Extension;
using System.Data.Common;
// Create connection using builder
var connectionDefine = new MySqlConnectionDefine()
.WithServer("localhost")
.WithPort(3306)
.WithDatabase("mydb")
.WithUserId("root")
.WithPassword("password")
.WithCharset("utf8mb4");
var descriptor = connectionDefine.GetDbConnectionDescriptor(
MySqlConnectionDefine.DATABASE_TYPE, "Default");
var provider = new MySqlProvider();
using var connection = provider.GetDbConnection(descriptor.ConnectionString);
connection.Open();
// Create a table
var columnDescriptors = new List<DbColumnDesciptor>
{
new DbColumnDesciptor { ColumnName = "Id", ColumnType = "INT", PrimaryKeyFlag = true, NullableFlag = false },
new DbColumnDesciptor { ColumnName = "Name", ColumnType = "VARCHAR(100)", PrimaryKeyFlag = false, NullableFlag = false },
new DbColumnDesciptor { ColumnName = "Age", ColumnType = "INT", PrimaryKeyFlag = false, NullableFlag = true }
};
var createTableSql = provider.SqlProvider.CreateTable(string.Empty, "Users", columnDescriptors);
using var createCommand = provider.GetDbCommand(connection);
createCommand.CommandText = createTableSql.Sql;
await createCommand.ExecuteNonQueryAsync();
// Insert data
var insertSql = new Sqled("INSERT INTO `Users` (Name, Age) VALUES (@name, @age)")
.Set("name", "John Doe")
.Set("age", 30);
using var insertCommand = provider.GetDbCommand(connection);
insertCommand.CommandText = insertSql.Sql;
provider.SetParameters(insertCommand, insertSql.Parameters);
await insertCommand.ExecuteNonQueryAsync();
// Query data
var selectSql = new Sqled("SELECT * FROM `Users` WHERE Age > @minAge")
.Set("minAge", 18);
await provider.ReadAsync(connection, selectSql, async reader =>
{
while (await reader.ReadAsync())
{
var id = reader["Id"];
var name = reader["Name"];
var age = reader["Age"];
Console.WriteLine($"Id: {id}, Name: {name}, Age: {age}");
}
});
Connection Builder
Use the fluent builder for connection configuration:
using Delly.DBunny.MySql;
using Delly.DBunny.Connecting.Extension;
var connectionDefine = new MySqlConnectionDefine()
.WithServer("localhost")
.WithPort(3306)
.WithDatabase("mydb")
.WithUserId("root")
.WithPassword("password")
.WithCharset("utf8mb4")
.WithSslMode("None")
.WithAllowPublicKeyRetrieval(true)
.WithConnectionTimeout(30)
.WithDefaultCommandTimeout(600)
.WithPooling(true)
.WithMinPoolSize(0)
.WithMaxPoolSize(100);
var descriptor = connectionDefine.GetDbConnectionDescriptor(
MySqlConnectionDefine.DATABASE_TYPE, "Default");
Connection Parameters
| Parameter | Default | Description |
|---|---|---|
| Server | localhost | MySQL server host |
| Port | 3306 | MySQL server port |
| Database | - | Database name |
| User Id | - | Username |
| Password | - | Password |
| Charset | utf8mb4 | Character set |
| SSL Mode | Required | SSL mode (None, Preferred, Required, DisableCAVerification, VerifyCA, VerifyFull) |
| Allow Public Key Retrieval | True | Allow public key retrieval (for authentication) |
| Connection Timeout | 30 | Connection timeout in seconds |
| Default Command Timeout | 600 | Command timeout in seconds |
| Pooling | True | Enable connection pooling |
| Minimum Pool Size | 0 | Minimum pool size |
| Maximum Pool Size | 100 | Maximum pool size |
| Persist Security Info | False | Persist security info in connection string |
| Allow Zero DateTime | False | Allow zero datetime values (0000-00-00) |
| Convert Zero DateTime | True | Convert zero datetime to DateTime.MinValue |
MySQL Features
- Database Layer: MySQL uses databases (no separate schema layer)
- No Schema Layer: MySQL doesn't use separate schemas
- Name Quoting: Uses backticks
`name` - Parameter Prefix:
@ - Auto Increment: Uses
AUTO_INCREMENTfor auto-incrementing primary keys - Type Mapping:
- Boolean → TINYINT(1)
- Byte, SByte → TINYINT(3)
- Int16, UInt16 → SMALLINT
- Int32, UInt32 → INT
- Int64, UInt64 → BIGINT
- Single → FLOAT
- Double → DOUBLE
- Decimal → DECIMAL
- DateTime → DATETIME
- String (<=65535 chars) → VARCHAR
- String (>65535 chars) → TEXT
MariaDB Compatibility
This provider also works with MariaDB using the same connection parameters and MySqlConnector driver.
SSL Mode Options
- None: No SSL (not recommended for production)
- Preferred: Try SSL first, fall back to non-SSL
- Required: SSL required (but certificate not verified)
- VerifyCA: SSL required and certificate authority verified
- VerifyFull: SSL required with full certificate verification
Zero DateTime Handling
MySQL supports "zero" datetime values (0000-00-00). To handle these:
// Allow reading zero datetime values
connectionDefine.WithAllowZeroDateTime(true);
// Convert zero datetime to DateTime.MinValue (default enabled)
connectionDefine.WithConvertZeroDateTime(true);
Dependencies
- MySqlConnector 2.4.0
License
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 is compatible. 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 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 | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. 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.
-
.NETStandard 2.0
- Delly.DBunny.Core (>= 2026.5.7)
- MySqlConnector (>= 2.4.0)
-
net5.0
- Delly.DBunny.Core (>= 2026.5.7)
- MySqlConnector (>= 2.4.0)
-
net8.0
- Delly.DBunny.Core (>= 2026.5.7)
- MySqlConnector (>= 2.4.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.