Net4x.DapperLibrary.Generic 1.9.9.7

There is a newer version of this package available.
See the version list below for details.
dotnet add package Net4x.DapperLibrary.Generic --version 1.9.9.7
                    
NuGet\Install-Package Net4x.DapperLibrary.Generic -Version 1.9.9.7
                    
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.Generic" Version="1.9.9.7" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Net4x.DapperLibrary.Generic" Version="1.9.9.7" />
                    
Directory.Packages.props
<PackageReference Include="Net4x.DapperLibrary.Generic" />
                    
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.Generic --version 1.9.9.7
                    
#r "nuget: Net4x.DapperLibrary.Generic, 1.9.9.7"
                    
#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.Generic@1.9.9.7
                    
#: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.Generic&version=1.9.9.7
                    
Install as a Cake Addin
#tool nuget:?package=Net4x.DapperLibrary.Generic&version=1.9.9.7
                    
Install as a Cake Tool

DapperLibrary.Generic


# DapperLibrary.Generic

A small, provider-agnostic layer that adapts ADO.NET `DbProviderFactory` implementations into the DapperLibrary plumbing.

This project exposes a generic provider factory and a generic dapper context which can be used to integrate arbitrary ADO.NET providers (SQL Server, MySQL, Oracle, OLE DB, etc.) with the DapperLibrary model, parameter handling and data adapter event wiring.

## Main types

- `GenericProviderFactory<TFactory, TRowUpdatedEventArgs>`
  - Adapts a `DbProviderFactory` (`TFactory`) into the DapperLibrary `ProviderFactoryBase`.
  - Copies custom `DatabaseModel` settings into the library's `GenericDatabaseModel` and `GenericDatabaseModelTypes`.
  - Hooks adapter events (`RowUpdated`, `RowUpdating`) and forwards them to the DapperLibrary event model.
  - Configures the `ParameterModel` (prefix, indexing and parameter preparation delegate).

- `GenericDapperContext<TFactory, TRowUpdatedEventArgs>`
  - `DapperContext` subclass that uses `GenericProviderFactory<TFactory,TRowUpdatedEventArgs>`.
  - Constructors:
    - Older platform overload (NET35/NET40) accepts `(TFactory factory, DatabaseModel model)` and constructs the context using an internal `DapperConfigurationManager`.
    - Modern overload accepts `(IConfiguration configuration, TFactory factory, DatabaseModel model)`.

- `GenericDatabaseModel`, `GenericDatabaseModelTypes`, `GenericDatabaseEnumTypes`
  - Default implementations of `IDatabaseModel`, `IDatabaseModelTypes` and `IDatabaseEnumTypes` suitable for a wide range of relational databases.
  - Provide configurable delimiters, parameter naming, type mapping strings and helpers such as `FormatDatetimeAsString`.

## Quick usage example

1) Prepare a database model (customize what you need):

```csharp
var model = new DapperLibrary.Generic.DbContexts.GenericDatabaseModel();
model.BeginDelimiter = "\""; // or "[" for SQL Server
model.EndDelimiter = "\"";
model.ParameterPrefix = "@";
// adjust types if needed: model.Types.VarChar = "varchar({0})";
```

2) Create the provider factory instance for your provider and construct a context. Example for System.Data.SqlClient (desktop .NET):

```csharp
using System.Data.SqlClient;
using Microsoft.Extensions.Configuration;

var configuration = new ConfigurationBuilder().Build();
var factory = SqlClientFactory.Instance; // TFactory

using var context = new GenericDapperContext<SqlClientFactory, SqlRowUpdatedEventArgs>(configuration, factory, model);

// use context.Operations, context.Schema, context.SaveDataTable, etc.
```

## Notes and recommendations

- `GenericProviderFactory` wires up `DbDataAdapter` events via reflection so adapters that expose `RowUpdated`/`RowUpdating` will be handled. Ensure your provider's adapter exposes those events if you rely on them.
- The generic type parameter `TRowUpdatedEventArgs` must match the adapter's row event argument type for your provider (for example `SqlRowUpdatedEventArgs` for `System.Data.SqlClient`).
- The library sets `ParameterModel.PrepareCommandParameters` to a delegate; if your provider requires special parameter handling you can set `DatabaseModel.ParameterPrefix` and other `DatabaseModel` properties accordingly.
- For older runtimes (NET35/NET40) use the constructor that accepts the factory and `DatabaseModel` without `IConfiguration`.

## Integration

- `GenericDapperContext` is intended to be used where there isn't a provider-specific `DapperContext` implementation in the solution. For provider-specific features (SQLite in-memory semantics, SQL Server LocalDB helpers, etc.) prefer the corresponding provider project (see other READMEs in the repository).

## License / Contributing

See repository root for license and contribution guidelines.
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.8 136 2/2/2026
1.9.9.7 138 1/13/2026
1.9.9.6 132 1/6/2026
1.9.9.5 134 1/6/2026
1.9.9.4 134 1/6/2026
1.9.9.3 143 1/5/2026
1.9.9.2 134 12/30/2025
1.9.9.1 148 12/30/2025
1.9.9 225 12/22/2025
1.6.0.12 179 12/12/2025
1.6.0.11 159 12/12/2025
1.6.0.10 490 12/9/2025
1.6.0.9 249 12/4/2025
1.6.0.8 248 12/4/2025
1.6.0.7 312 11/30/2025
1.6.0.6 238 11/27/2025
1.6.0.5 289 11/22/2025
1.6.0.4 193 11/16/2025
1.6.0.3 234 11/15/2025
1.6.0.2 326 11/14/2025
Loading failed