public class IHtmlStringTypeHandler : SqlMapper.TypeHandler<IHtmlString>
{
public override void SetValue(
IDbDataParameter parameter,
IHtmlString value)
{
parameter.DbType = DbType.String;
parameter.Value = value?.ToHtmlString();
}
public override IHtmlString Parse(object value)
{
return MvcHtmlString.Create(value?.ToString());
}
}