Is there any way to trace\log the sql using Dapper?

I got the same issue and implemented some code after doing some search but having no ready-to-use stuff. There is a package on nuget MiniProfiler.Integrations I would like to share. Update V2: it supports to work with other database servers, for MySQL it requires to have MiniProfiler.Integrations.MySql Below are steps to work with SQL Server: … Read more

Manually map column names with class properties

Dapper now supports custom column to property mappers. It does so through the ITypeMap interface. A CustomPropertyTypeMap class is provided by Dapper that can do most of this work. For example: Dapper.SqlMapper.SetTypeMap( typeof(TModel), new CustomPropertyTypeMap( typeof(TModel), (type, columnName) => type.GetProperties().FirstOrDefault(prop => prop.GetCustomAttributes(false) .OfType<ColumnAttribute>() .Any(attr => attr.Name == columnName)))); And the model: public class TModel { … Read more