Net4x.DapperLibrary.Odbc
1.9.9.26271
dotnet add package Net4x.DapperLibrary.Odbc --version 1.9.9.26271
NuGet\Install-Package Net4x.DapperLibrary.Odbc -Version 1.9.9.26271
<PackageReference Include="Net4x.DapperLibrary.Odbc" Version="1.9.9.26271" />
<PackageVersion Include="Net4x.DapperLibrary.Odbc" Version="1.9.9.26271" />
<PackageReference Include="Net4x.DapperLibrary.Odbc" />
paket add Net4x.DapperLibrary.Odbc --version 1.9.9.26271
#r "nuget: Net4x.DapperLibrary.Odbc, 1.9.9.26271"
#:package Net4x.DapperLibrary.Odbc@1.9.9.26271
#addin nuget:?package=Net4x.DapperLibrary.Odbc&version=1.9.9.26271
#tool nuget:?package=Net4x.DapperLibrary.Odbc&version=1.9.9.26271
DapperLibrary.Odbc
ODBC provider integration for DapperLibrary. This project provides an ODBC-specific DapperContext implementation, a provider factory and database model/type mappings suitable for ADO.NET ODBC providers.
Purpose
Provide ODBC engine-specific behavior while preserving the common DapperLibrary API. The assembly includes:
OdbcDapperContext� aDapperContextwired to ODBC viaOdbcProviderFactoryandDapperConfigurationManagerforSystem.Data.Odbc.OdbcProviderFactory� configures parameter handling, command parameter preparation and adapter events for ODBC semantics.OdbcDatabaseModel,OleDbDatabaseModelTypesandOdbcDatabaseEnumTypes� identifier delimiters, statement terminator, parameter naming and provider-specific type mappings.
Key types
OdbcDapperContext- Derives from
DapperContextand can be constructed from anIConfigurationinstance. - Uses
OdbcProviderFactoryto create provider-specific behavior and maps configuration viaDapperConfigurationManager.
- Derives from
OdbcProviderFactory- Inherits from
ProviderFactoryBaseand delegates toOdbcFactory.Instance. - Uses
ParameterModel.ParameterPrefix = "?"andParameterModel.AddIndex = falseto match ODBC positional parameter conventions. - Implements
PrepareCommandParametersto createDbParameterinstances, add them to the command and format the command text with parameter names. - Attaches to
RowUpdated/RowUpdatingevents onOdbcDataAdapterand forwards them.
- Inherits from
OdbcDatabaseModeland related types- Identifier delimiters:
[and]. - Statement terminator:
;. - Parameter prefix:
?and parameter base name:Par. - Type mapping uses
OleDbDatabaseModelTypesin this project for string/type templates andOdbcDatabaseEnumTypesfor ODBC-specific enum values (for exampleOdbcType.VarChar,OdbcType.Int,OdbcType.Date, etc.).
- Identifier delimiters:
Usage examples
Create and use an OdbcDapperContext:
var configuration = /* IConfiguration with connection strings */;
using var context = new OdbcDapperContext(configuration);
// use context.Operations / context.Schema / context.SaveDataTable etc.
The OdbcProviderFactory prepares command parameters by creating DbParameter instances and formatting the command text so that ODBC providers receive a command with positional ? parameters.
Parameter and placeholder conventions
- ODBC uses positional
?parameters. The provider factory setsParameterPrefixto?and disables index-based naming (AddIndex = false). PrepareCommandParameterswill create parameters, add them to the command and then replace placeholders like{0}with the actual parameter names.
Example flow:
- SQL with placeholders:
SELECT * FROM Table WHERE Id = {0} AND Name = {1} - Factory creates parameters
?and injects them into the command, then formats the command text to:SELECT * FROM Table WHERE Id = ? AND Name = ?(or provider-specific named parameters depending on provider behavior).
Multi-targeting & compatibility
- The project is included in a multi-targeted repository with many framework targets.
System.Data.Odbcis available on .NET Framework and certain .NET Core/.NET runtimes�ensure your target runtime supports ODBC if you plan to use this provider. - Conditional compilation across the solution allows producing framework-specific binaries where necessary.
Synchronous vs asynchronous behavior
- ODBC ADO.NET implementations historically have limited async support. DapperLibrary exposes both synchronous and asynchronous API variants, but on platforms/providers without true async support, the
Asyncmethods may operate synchronously internally. - Use synchronous APIs for runtimes/providers without reliable async support. Prefer async APIs when the underlying driver supports asynchronous I/O and you need non-blocking behavior.
Events and data adapter behavior
OdbcProviderFactory.CreateDataAdapterwiresRowUpdatedandRowUpdatingto forward adapter lifecycle events. Consumers that useDbDataAdapter-based save operations can subscribe to these events to customize row-level behavior.
Notes and best practices
- Because ODBC commonly uses positional parameters, avoid relying on named-parameter semantics; rely on the provider factory's
PrepareCommandParametersbehavior. - Use the
WithConnectionoverloads when executing operations against a different named connection for a single call to avoid contention aroundConnectionStringToRead. - For modern .NET applications where ODBC is not preferred, consider provider-specific clients (e.g., Npgsql, Microsoft.Data.SqlClient) for better async support and richer provider features.
For implementation details consult OdbcProviderFactory, OdbcDapperContext, and the DbContexts types in this project.
| 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 | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 is compatible. |
| .NET Framework | net35 is compatible. net40 is compatible. net403 was computed. net45 is compatible. net451 was computed. net452 was computed. net46 was computed. net461 is compatible. 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 | tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 3.5
- Net4x.DapperLibrary.Base (>= 1.9.9.26271)
-
.NETFramework 4.0
- Net4x.DapperLibrary.Base (>= 1.9.9.26271)
-
.NETFramework 4.5
- Net4x.DapperLibrary.Base (>= 1.9.9.26271)
-
.NETFramework 4.6.1
- Net4x.DapperLibrary.Base (>= 1.9.9.26271)
- System.Configuration.ConfigurationManager (>= 9.0.0)
-
.NETStandard 2.1
- Net4x.DapperLibrary.Base (>= 1.9.9.26271)
- System.Configuration.ConfigurationManager (>= 9.0.0)
- System.Data.Odbc (>= 7.0.0)
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.9.9.26271 | 81 | 9/28/2026 |
| 1.9.9.26270 | 82 | 9/27/2026 |
| 1.9.9.26263 | 91 | 9/20/2026 |
| 1.9.9.26262 | 85 | 9/20/2026 |
| 1.9.9.26248 | 97 | 9/4/2026 |
| 1.9.9.26247 | 101 | 9/4/2026 |
| 1.9.9.9 | 123 | 7/27/2026 |
| 1.9.9.8 | 134 | 2/2/2026 |
| 1.9.9.7 | 127 | 1/13/2026 |
| 1.9.9.6 | 128 | 1/6/2026 |
| 1.9.9.5 | 125 | 1/6/2026 |
| 1.9.9.4 | 125 | 1/6/2026 |
| 1.9.9.3 | 123 | 1/5/2026 |
| 1.9.9.2 | 128 | 12/30/2025 |
| 1.9.9.1 | 124 | 12/30/2025 |
| 1.9.9 | 205 | 12/22/2025 |
| 1.6.0.12 | 158 | 12/12/2025 |
| 1.6.0.11 | 155 | 12/12/2025 |
| 1.6.0.10 | 457 | 12/9/2025 |