added ConverterContext to marr Converters.

This commit is contained in:
kay.one
2013-09-20 23:38:27 -07:00
committed by kayone
parent d1a4c7c942
commit 08e2d60f20
15 changed files with 153 additions and 34 deletions
+8 -3
View File
@@ -20,11 +20,16 @@ namespace Marr.Data.Converters
{
public class EnumStringConverter : IConverter
{
public object FromDB(ConverterContext context)
{
if (context.DbValue == null || context.DbValue == DBNull.Value)
return null;
return Enum.Parse(context.ColumnMap.FieldType, (string)context.DbValue);
}
public object FromDB(ColumnMap map, object dbValue)
{
if (dbValue == null || dbValue == DBNull.Value)
return null;
return Enum.Parse(map.FieldType, (string)dbValue);
return FromDB(new ConverterContext { ColumnMap = map, DbValue = dbValue });
}
public object ToDB(object clrValue)