Skip to content

Instantly share code, notes, and snippets.

View senjacob's full-sized avatar

Sen Jacob senjacob

  • Trenser Technology Solutions
  • Trivandrum
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";
@senjacob
senjacob / DbProvider.cs
Created January 21, 2014 12:08
Simple utility functions for connecting to database
using System.Data;
using System.Configuration;
using System.Data.Common;
using System.Data.Linq;
namespace Dapper
{
/// <summary>
/// Utility functions for connecting to database
/// </summary>