Net4x.DapperLibrary.MySql 1.9.9

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

DapperLibrary.MySql

MySQL provider integration for DapperLibrary. This project supplies a MySQL-specific DapperContext implementation, a provider factory and MySQL-specific database model and type mappings using MySql.Data.

Purpose

Provide MySQL engine-specific behavior while preserving the common DapperLibrary API. The assembly includes:

  • MySqlDapperContext � a DapperContext configured for MySQL and wired to MySqlProviderFactory and DapperConfigurationManager.
  • MySqlProviderFactory � configures parameter handling, data adapter events and the database model factory for MySQL.
  • MySqlDatabaseModel, MySqlDatabaseModelTypes and MySqlDatabaseEnumTypes � identifier delimiters, statement terminator, parameter naming and SQL type mappings for MySQL.

Key types

  • MySqlDapperContext

    • Derives from DapperContext and initializes the context with MySqlProviderFactory and optional configuration.
    • Static helpers Use, Use(IContextCreator), Use(string, string) and UseOnce integrate with DapperContextFactory and set MySQL-friendly defaults when contexts are created:
      • DatabaseModel.IdentityInitializer = "AUTO_INCREMENT"
      • DatabaseModel.FormatDatetimeAsString = dateTime => $"STR_TO_DATE('{dateTime:yyyy-MM-dd HH:mm:ss}', '%Y-%m-%d %H:%i:%s')"
  • MySqlProviderFactory

    • Inherits from ProviderFactoryBase and uses MySqlClientFactory.Instance as the underlying provider.
    • Sets ParameterModel.AddIndex = true and installs PrepareCommandParameters delegate.
    • Attaches to RowUpdating / RowUpdated events of MySqlDataAdapter and forwards them so consumers can listen to adapter lifecycle events.
  • MySqlDatabaseModel and related types

    • Identifier delimiters: ` (backtick).
    • Statement terminator: ;.
    • Parameter prefix: @ and parameter base name: Par.
    • Type mappings reflect MySQL types (for example BIGINT, INT, TINYINT, DATETIME, JSON, LONGBLOB, DECIMAL, DOUBLE, etc.).

Usage examples

Create and use a MySqlDapperContext directly:

using var context = new MySqlDapperContext();
// use context.Operations / context.Schema / context.SaveDataTable etc.

Register a context creator in bootstrap code:

MySqlDapperContext.Use();

// or bind an explicit connection string and provider name
MySqlDapperContext.UseOnce(connectionString, providerName);

When contexts are created via the static helpers, the database model will be pre-configured with MySQL-sized defaults for identity columns and datetime literal formatting.

Multi-targeting & compatibility

  • The project targets .NET Standard and is intended to work across modern .NET runtimes. Ensure your application references a compatible MySql.Data package version for the target framework.
  • The broader solution contains conditional compilation for other providers and frameworks to produce framework-specific assets when building the full library.

Synchronous vs asynchronous behavior

  • MySQL provider (MySql.Data) supports asynchronous operations. DapperLibrary exposes synchronous and asynchronous variants for operations (GetDataReaderAsync, GetDataTableAsync, SetDataAsync, QueryAsync<T>, etc.).
  • Prefer Async methods in server and I/O-bound applications to avoid blocking threads. For legacy or synchronous-only scenarios you can use the synchronous APIs.

Events and data adapter behavior

  • MySqlProviderFactory.CreateDataAdapter wires RowUpdating and RowUpdated events from MySqlDataAdapter and forwards them through the provider factory. Consumers using adapter-based persistence can subscribe to these events to inspect or change update lifecycle behavior.

Notes and best practices

  • Use WithConnection overloads when executing operations against a different named connection for a single call to avoid contention around ConnectionStringToRead.
  • Rely on schema helpers (IDapperContext.Schema) and the library�s caching for efficient metadata reads.
  • When persisting entities or DataTables, verify the MySQL server character set and collation settings to avoid unexpected conversions for binary/text data.

For implementation details consult the source files under DbContexts and MySqlProviderFactory.

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.  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 is compatible. 
.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.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Net4x.DapperLibrary.MySql:

Package Downloads
Net4x.DapperLibrary.Docker

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.9.9 123 12/22/2025
1.6.0.12 240 12/12/2025
1.6.0.11 211 12/12/2025
1.6.0.10 528 12/9/2025
1.6.0.9 183 12/4/2025
1.6.0.8 186 12/4/2025
1.6.0.7 248 11/30/2025
1.6.0.6 170 11/27/2025
1.6.0.5 216 11/22/2025
1.6.0.4 124 11/16/2025
1.6.0.3 174 11/15/2025
1.6.0.2 261 11/14/2025
1.6.0.1 222 11/10/2025
1.6.0 198 11/9/2025
1.5.0.4 203 11/9/2025
1.5.0.3 185 11/5/2025
1.5.0.2 182 11/3/2025
1.5.0.1 183 11/3/2025
1.5.0 134 10/26/2025
1.4.1.6 173 10/24/2025
1.4.1.5 173 10/22/2025