Skip to content

Instantly share code, notes, and snippets.

View azilberbaum's full-sized avatar

Adam Zilberbaum azilberbaum

View GitHub Profile
@senjacob
senjacob / ColumnAttributeTypeMapper.cs
Last active May 21, 2024 14:28 — forked from kalebpederson/ColumnAttributeTypeMapper.cs
Map column names with class properties in Dapper-dot-net using ITypeMap and CustomAttributes
namespace YourNamespace
{
/// <summary>
/// Uses the Name value of the ColumnAttribute specified, otherwise maps as usual.
/// </summary>
/// <typeparam name="T">The type of the object that this mapper applies to.</typeparam>
public class ColumnAttributeTypeMapper<T> : FallbackTypeMapper
{
public static readonly string ColumnAttributeName = "ColumnAttribute";