mirror of
https://github.com/lidarr/Lidarr
synced 2024-12-26 01:27:00 +00:00
Fixed enum mapping issue
This commit is contained in:
parent
0e86653d8a
commit
5629d68645
4 changed files with 10 additions and 42 deletions
|
@ -23,17 +23,6 @@ public static string[] StandardSeries
|
||||||
get { return new[] { "c:\\tv\\the simpsons", "c:\\tv\\family guy", "c:\\tv\\southpark", "c:\\tv\\24" }; }
|
get { return new[] { "c:\\tv\\the simpsons", "c:\\tv\\family guy", "c:\\tv\\southpark", "c:\\tv\\24" }; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ConfigProvider StandardConfig
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
var mock = new Mock<ConfigProvider>();
|
|
||||||
mock.SetupGet(c => c.SeriesRoot).Returns("C:\\");
|
|
||||||
return mock.Object;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static IDatabase GetEmptyDatabase(bool enableLogging = false, string fileName = "")
|
public static IDatabase GetEmptyDatabase(bool enableLogging = false, string fileName = "")
|
||||||
{
|
{
|
||||||
Console.WriteLine("Creating an empty PetaPoco database");
|
Console.WriteLine("Creating an empty PetaPoco database");
|
||||||
|
@ -83,14 +72,5 @@ public static Series GetFakeSeries(int id, string title)
|
||||||
.With(c => c.CleanTitle = Parser.NormalizeTitle(title))
|
.With(c => c.CleanTitle = Parser.NormalizeTitle(title))
|
||||||
.Build();
|
.Build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IList<Episode> GetFakeEpisodes(int seriesId)
|
|
||||||
{
|
|
||||||
var epNumber = new SequentialGenerator<int>();
|
|
||||||
return Builder<Episode>.CreateListOfSize(10)
|
|
||||||
.WhereAll().Have(c => c.SeriesId = seriesId)
|
|
||||||
.WhereAll().Have(c => c.EpisodeNumber = epNumber.Generate())
|
|
||||||
.Build();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Binary file not shown.
|
@ -5,10 +5,10 @@ namespace NzbDrone.Core.Datastore
|
||||||
{
|
{
|
||||||
public class CustomeMapper : DefaultMapper
|
public class CustomeMapper : DefaultMapper
|
||||||
{
|
{
|
||||||
public override Func<object, object> GetFromDbConverter(DestinationInfo destinationInfo, Type SourceType)
|
public override Func<object, object> GetFromDbConverter(DestinationInfo destinationInfo, Type sourceType)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ((SourceType == typeof(Int32) || SourceType == typeof(Int64)) && destinationInfo.Type.IsGenericType && destinationInfo.Type.GetGenericTypeDefinition() == typeof(Nullable<>))
|
if ((sourceType == typeof(Int32) || sourceType == typeof(Int64)) && destinationInfo.Type.IsGenericType && destinationInfo.Type.GetGenericTypeDefinition() == typeof(Nullable<>))
|
||||||
{
|
{
|
||||||
// If it is NULLABLE, then get the underlying type. eg if "Nullable<int>" then this will return just "int"
|
// If it is NULLABLE, then get the underlying type. eg if "Nullable<int>" then this will return just "int"
|
||||||
Type genericArgument = destinationInfo.Type.GetGenericArguments()[0];
|
Type genericArgument = destinationInfo.Type.GetGenericArguments()[0];
|
||||||
|
@ -18,31 +18,19 @@ public override Func<object, object> GetFromDbConverter(DestinationInfo destinat
|
||||||
{
|
{
|
||||||
int value;
|
int value;
|
||||||
Int32.TryParse(s.ToString(), out value);
|
Int32.TryParse(s.ToString(), out value);
|
||||||
if (value == 0)
|
return (DayOfWeek?)value;
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (Nullable<DayOfWeek>)value;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return delegate(object s)
|
return delegate(object s)
|
||||||
{
|
{
|
||||||
int value;
|
int value;
|
||||||
Int32.TryParse(s.ToString(), out value);
|
Int32.TryParse(s.ToString(), out value);
|
||||||
if (value == 0)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return base.GetFromDbConverter(destinationInfo, SourceType);
|
return base.GetFromDbConverter(destinationInfo, sourceType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
BIN
packages/Glimpse.0.81/lib/net40/Glimpse.Net.dll
vendored
BIN
packages/Glimpse.0.81/lib/net40/Glimpse.Net.dll
vendored
Binary file not shown.
Loading…
Reference in a new issue