Looking for dapper Answers? Try Ask4KnowledgeBase
Looking for dapper Keywords? Try Ask4Keywords

Dapper.NET Installing a TypeHandler


The above type handler can be installed into SqlMapper using the AddTypeHandler method.

SqlMapper.AddTypeHandler<IHtmlString>(new IHtmlStringTypeHandler());

Type inference allows you to omit the generic type parameter:

SqlMapper.AddTypeHandler(new IHtmlStringTypeHandler());

There's also a two-argument overload which takes an explicit Type argument:

SqlMapper.AddTypeHandler(typeof(IHtmlString), new IHtmlStringTypeHandler());