mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 18:57:39 -07:00
minor cleanup
This commit is contained in:
parent
85fd0e1c22
commit
9efee65966
8 changed files with 25 additions and 9 deletions
37
NzbDrone.Core/Datastore/Converters/EnumIntConverter.cs
Normal file
37
NzbDrone.Core/Datastore/Converters/EnumIntConverter.cs
Normal file
|
@ -0,0 +1,37 @@
|
|||
using System;
|
||||
using Marr.Data.Converters;
|
||||
using Marr.Data.Mapping;
|
||||
|
||||
namespace NzbDrone.Core.Datastore.Converters
|
||||
{
|
||||
public class EnumIntConverter : IConverter
|
||||
{
|
||||
public Type DbType
|
||||
{
|
||||
get
|
||||
{
|
||||
return typeof(int);
|
||||
}
|
||||
}
|
||||
|
||||
public object FromDB(ColumnMap map, object dbValue)
|
||||
{
|
||||
if (dbValue != null && dbValue != DBNull.Value)
|
||||
{
|
||||
return Enum.ToObject(map.FieldType, (Int64)dbValue);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public object ToDB(object clrValue)
|
||||
{
|
||||
if (clrValue != null)
|
||||
{
|
||||
return (int)clrValue;
|
||||
}
|
||||
|
||||
return DBNull.Value;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue