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

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 � a DapperContext wired to ODBC via OdbcProviderFactory and DapperConfigurationManager for System.Data.Odbc.
  • OdbcProviderFactory � configures parameter handling, command parameter preparation and adapter events for ODBC semantics.
  • OdbcDatabaseModel, OleDbDatabaseModelTypes and OdbcDatabaseEnumTypes � identifier delimiters, statement terminator, parameter naming and provider-specific type mappings.

Key types

  • OdbcDapperContext

    • Derives from DapperContext and can be constructed from an IConfiguration instance.
    • Uses OdbcProviderFactory to create provider-specific behavior and maps configuration via DapperConfigurationManager.
  • OdbcProviderFactory

    • Inherits from ProviderFactoryBase and delegates to OdbcFactory.Instance.
    • Uses ParameterModel.ParameterPrefix = "?" and ParameterModel.AddIndex = false to match ODBC positional parameter conventions.
    • Implements PrepareCommandParameters to create DbParameter instances, add them to the command and format the command text with parameter names.
    • Attaches to RowUpdated/RowUpdating events on OdbcDataAdapter and forwards them.
  • OdbcDatabaseModel and related types

    • Identifier delimiters: [ and ].
    • Statement terminator: ;.
    • Parameter prefix: ? and parameter base name: Par.
    • Type mapping uses OleDbDatabaseModelTypes in this project for string/type templates and OdbcDatabaseEnumTypes for ODBC-specific enum values (for example OdbcType.VarChar, OdbcType.Int, OdbcType.Date, etc.).

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 sets ParameterPrefix to ? and disables index-based naming (AddIndex = false).
  • PrepareCommandParameters will 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.Odbc is 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 Async methods 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.CreateDataAdapter wires RowUpdated and RowUpdating to forward adapter lifecycle events. Consumers that use DbDataAdapter-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 PrepareCommandParameters behavior.
  • Use the WithConnection overloads when executing operations against a different named connection for a single call to avoid contention around ConnectionStringToRead.
  • 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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