Package Description
$ dotnet add package Net4x.DapperLibrary.OleDbOLE DB provider integration for DapperLibrary. This project supplies an OLE DB-specific DapperContext implementation, a provider factory and database model/type mappings suitable for ADO.NET OLE DB providers.
Provide OLE DB engine-specific behavior while preserving the common DapperLibrary API. The assembly includes:
OleDbDapperContext � a DapperContext configured for OLE DB and wired to configuration via DapperConfigurationManager.OleDbProviderFactory � configures parameter handling, data adapter event forwarding and command parameter preparation tailored for OLE DB semantics.OleDbDatabaseModel, OleDbDatabaseModelTypes and OleDbDatabaseEnumTypes � identifier delimiters, statement terminator, parameter naming and provider-specific type/string mappings.OleDbDapperContext
DapperContext and is initialized with OleDbProviderFactory and a DapperConfigurationManager that targets the System.Data.OleDb namespace.IConfiguration instance to pull connection strings and other configuration values.OleDbProviderFactory
ProviderFactoryBase and delegates to OleDbFactory.Instance.ParameterModel.ParameterPrefix = "?" and ParameterModel.AddIndex = false to match OLE DB parameter conventions (unnamed positional parameters commonly represented as ?).AddPrefixInParameterName = false and provides a PrepareCommandParameters implementation that creates objects, injects them into the command and formats the command text by replacing placeholders with parameter names.DbParameterRowUpdated/RowUpdating events on the OleDbDataAdapter and forwards them via the provider factory.OleDbDatabaseModel and related types
[ and ].;.? and parameter base name: Par.System.Data.OleDb.OleDbType names (for example Integer, BigInt, LongVarBinary, VarChar({0}), etc.).Create and use an OleDbDapperContext:
var configuration = /* IConfiguration with connection strings */;
using var context = new OleDbDapperContext(configuration);
// use context.Operations / context.Schema / context.SaveDataTable etc.The OleDbProviderFactory prepares command parameters by creating DbParameter instances and formatting the command text using parameter names (the provider uses positional ? parameters, so AddIndex is false by default in this factory).
? parameters. The provider factory sets ParameterPrefix to ? and does not add an index to parameter names by default (AddIndex = false).PrepareCommandParameters builds parameters and then replaces indexed placeholders in the SQL command with the parameter names. This keeps parameter handling consistent with other providers in the DapperLibraries while accommodating OLE DB conventions.Example of how values are bound in the provider:
{0}, {1}, the factory will create parameters, add them to the command and then format the command text using the actual parameter names so the provider receives a command with ?-style parameters.System.Data.OleDb) are available in .NET Framework; when targeting .NET Core/.NET 5+ consider using ODBC or provider-specific clients if native OLE DB support isn't available for your runtime.Async-suffixed methods may execute synchronously under the hood or use provider-specific async shims.OleDbProviderFactory.CreateDataAdapter attaches RowUpdating and RowUpdated event handlers and forwards these events via the provider factory. Consumers using DbDataAdapter-based save operations can subscribe to these events to customize row-level update behavior.PrepareCommandParameters conventions implemented by the provider factory instead.WithConnection overloads on DapperLibrary APIs to target specific named connections for single calls to avoid shared-state contention around ConnectionStringToRead.For implementation details review OleDbProviderFactory, OleDbDapperContext and the DbContexts types in this project.