1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-18 21:35:51 -04:00
Files
Radarr/src/NzbDrone.Core/Datastore/Converters/OsPathConverter.cs
T
2014-11-19 21:47:11 +01:00

44 lines
982 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Marr.Data.Converters;
using Marr.Data.Mapping;
using Newtonsoft.Json;
using NzbDrone.Common.Disk;
namespace NzbDrone.Core.Datastore.Converters
{
public class OsPathConverter : IConverter
{
public Object FromDB(ConverterContext context)
{
if (context.DbValue == DBNull.Value)
{
return DBNull.Value;
}
var value = (String)context.DbValue;
return new OsPath(value);
}
public Object FromDB(ColumnMap map, Object dbValue)
{
return FromDB(new ConverterContext { ColumnMap = map, DbValue = dbValue });
}
public Object ToDB(Object clrValue)
{
var value = (OsPath)clrValue;
return value.FullPath;
}
public Type DbType
{
get { return typeof(String); }
}
}
}