Dommel.Pag 1.2.10

.NET Standard 1.3
dotnet add package Dommel.Pag --version 1.2.10
NuGet\Install-Package Dommel.Pag -Version 1.2.10
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="Dommel.Pag" Version="1.2.10" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Dommel.Pag --version 1.2.10
#r "nuget: Dommel.Pag, 1.2.10"
#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.
// Install Dommel.Pag as a Cake Addin
#addin nuget:?package=Dommel.Pag&version=1.2.10

// Install Dommel.Pag as a Cake Tool
#tool nuget:?package=Dommel.Pag&version=1.2.10


Added column resolvers to work on Select/Get methods

Added paging support for Select/SelectAsync and Count/CountAsync and NO SYNC

Added support to provide the Primary Key value on Create with DatabaseGeneratedAttribute (DatabaseGeneratedOption.None) on Key mapping for Entities.

Added support for logs/audit with methods that return the executed query and its params.


Simple CRUD operations for Dapper.

Windows Linux
Build status Build Status


Dommel provides a convenient API for CRUD operations using extension methods on the IDbConnection interface. The SQL queries are generated based on your POCO entities. Dommel also supports LINQ expressions which are being translated to SQL expressions. Dapper is used for query execution and object mapping.

Dommel also provides extensibility points to change the bahavior of resolving table names, column names, the key property and POCO properties. See Extensibility for more details.



Download Dommel on NuGet



Retrieving entities by id
using (var con = new SqlConnection())
   var product = con.Get<Product>(1);
Retrieving all entities in a table
using (var con = new SqlConnection())
   var products = con.GetAll<Product>().ToList();
Selecting entities using a predicate

Dommel allows you to specify a predicate which is being translated into a SQL expression. The arguments in the lambda expression are added as parameters to the command.

using (var con = new SqlConnection())
   var products = con.Select<Product>(p => p.Name == "Awesome bike");
   var products = con.Select<Product>(p => p.Created < new DateTime(2014, 12, 31) && p.InStock > 5);
Inserting entities
using (var con = new SqlConnection())
   var product = new Product { Name = "Awesome bike", InStock = 4 };
   int id = con.Insert(product);
Updating entities
using (var con = new SqlConnection())
   var product = con.Get<Product>(1);
   product.LastUpdate = DateTime.Now;
Removing entities
using (var con = new SqlConnection())
   var product = con.Get<Product>(1);


Query builders

Dommel supports building specialized queries for a certain RDBMS. By default, query builders for the following RDMBS are included: SQL Server, SQL Server CE, SQLite, MySQL and Postgres. The query builder to be used is determined by the connection type. To add or overwrite an existing query builder, use the AddSqlBuilder() method:

DommelMapper.AddSqlBuilder(typeof(SqlConnection), new CustomSqlBuilder());




Implement this interface if you want to customize the resolving of table names when building SQL queries.

public class CustomTableNameResolver : DommelMapper.ITableNameResolver
    public string ResolveTableName(Type type)
        // Every table has prefix 'tbl'.
        return $"tbl{type.Name}";

Use the SetTableNameResolver() method to register the custom implementation:

DommelMapper.SetTableNameResolver(new CustomTableNameResolver());

Implement this interface if you want to customize the resolving of the key property of an entity. By default, Dommel will search for a property with the [Key] attribute, or a column with the name 'Id'.

If you, for example, have the naming convention of {TypeName}Id for key properties, you would implement the IKeyPropertyResolver like this:

public class CustomKeyPropertyResolver : DommelMapper.IKeyPropertyResolver
    public PropertyInfo ResolveKeyProperty(Type type)
        return type.GetProperties().Single(p => p.Name == $"{type.Name}Id");

Use the SetKeyPropertyResolver() method to register the custom implementation:

DommelMapper.SetKeyPropertyResolver(new CustomKeyPropertyResolver());

Implement this interface if you want to customize the resolving of column names for when building SQL queries. This is useful when your naming conventions for database columns are different than your POCO properties.

public class CustomColumnNameResolver : DommelMapper.IColumnNameResolver
    public string ResolveColumnName(PropertyInfo propertyInfo)
        // Every column has prefix 'fld' and is uppercase.
        return $"fld{propertyInfo.Name.ToUpper()}";

Use the SetColumnNameResolver() method to register the custom implementation:

DommelMapper.SetColumnNameResolver(new CustomColumnNameResolver());

The Dapper.FluentMap.Dommel extension implements these interfaces using the configured mapping. Also see: Dapper.FluentMap.

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
.NET Core netcoreapp1.0 netcoreapp1.1 netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard1.3 netstandard1.4 netstandard1.5 netstandard1.6 netstandard2.0 netstandard2.1
.NET Framework net46 net461 net462 net463 net47 net471 net472 net48 net481
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen30 tizen40 tizen60
Universal Windows Platform uap uap10.0
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
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.2.10 12,591 1/24/2019
1.2.9 2,840 8/8/2018
1.2.8 798 8/2/2018
1.2.7 668 8/1/2018
1.2.6 684 8/1/2018
1.2.5 665 8/1/2018
1.2.4 1,107 5/2/2018
1.2.3 1,573 4/19/2018
1.2.2 1,053 3/20/2018
1.2.1 812 3/19/2018
1.2.0 740 3/19/2018
1.1.0 768 3/19/2018
1.0.0 700 3/15/2018