2013-06-09 20:50:57 +00:00
|
|
|
|
using System;
|
|
|
|
|
using Marr.Data.Converters;
|
|
|
|
|
using Marr.Data.Mapping;
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Datastore.Converters
|
|
|
|
|
{
|
|
|
|
|
public class UtcConverter : IConverter
|
|
|
|
|
{
|
|
|
|
|
public object FromDB(ColumnMap map, object dbValue)
|
|
|
|
|
{
|
|
|
|
|
return dbValue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public object ToDB(object clrValue)
|
|
|
|
|
{
|
2013-06-10 02:10:15 +00:00
|
|
|
|
if (clrValue == DBNull.Value)
|
|
|
|
|
{
|
|
|
|
|
return clrValue;
|
|
|
|
|
}
|
|
|
|
|
|
2013-06-09 20:50:57 +00:00
|
|
|
|
var dateTime = (DateTime)clrValue;
|
|
|
|
|
return dateTime.ToUniversalTime();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Type DbType
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return typeof(DateTime);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|