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
<PackageReference Include="Net4x.DapperLibrary.MySql" Version="1.9.9" />
<PackageVersion Include="Net4x.DapperLibrary.MySql" Version="1.9.9" />
<PackageReference Include="Net4x.DapperLibrary.MySql" />
paket add Net4x.DapperLibrary.MySql --version 1.9.9
#r "nuget: Net4x.DapperLibrary.MySql, 1.9.9"
#:package Net4x.DapperLibrary.MySql@1.9.9
#addin nuget:?package=Net4x.DapperLibrary.MySql&version=1.9.9
#tool nuget:?package=Net4x.DapperLibrary.MySql&version=1.9.9
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� aDapperContextconfigured for MySQL and wired toMySqlProviderFactoryandDapperConfigurationManager.MySqlProviderFactory� configures parameter handling, data adapter events and the database model factory for MySQL.MySqlDatabaseModel,MySqlDatabaseModelTypesandMySqlDatabaseEnumTypes� identifier delimiters, statement terminator, parameter naming and SQL type mappings for MySQL.
Key types
MySqlDapperContext- Derives from
DapperContextand initializes the context withMySqlProviderFactoryand optional configuration. - Static helpers
Use,Use(IContextCreator),Use(string, string)andUseOnceintegrate withDapperContextFactoryand 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')"
- Derives from
MySqlProviderFactory- Inherits from
ProviderFactoryBaseand usesMySqlClientFactory.Instanceas the underlying provider. - Sets
ParameterModel.AddIndex = trueand installsPrepareCommandParametersdelegate. - Attaches to
RowUpdating/RowUpdatedevents ofMySqlDataAdapterand forwards them so consumers can listen to adapter lifecycle events.
- Inherits from
MySqlDatabaseModeland 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.).
- Identifier delimiters:
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.Datapackage 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
Asyncmethods 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.CreateDataAdapterwiresRowUpdatingandRowUpdatedevents fromMySqlDataAdapterand 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
WithConnectionoverloads when executing operations against a different named connection for a single call to avoid contention aroundConnectionStringToRead. - 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 | Versions 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. |
-
.NETStandard 2.0
- Azure.Identity (>= 1.13.1)
- MySql.Data (>= 9.4.0)
- Net4x.DapperLibrary.Base (>= 1.9.9)
- System.Configuration.ConfigurationManager (>= 9.0.0)
-
.NETStandard 2.1
- Azure.Identity (>= 1.13.1)
- MySql.Data (>= 9.4.0)
- Net4x.DapperLibrary.Base (>= 1.9.9)
- System.Configuration.ConfigurationManager (>= 9.0.0)
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 |