Fixed: Significantly improved api performance.

This commit is contained in:
Taloth Saldono
2016-03-25 01:56:29 +01:00
parent ff6737314f
commit a2536deef0
118 changed files with 2195 additions and 1019 deletions

View File

@@ -6,7 +6,6 @@ using NzbDrone.Common.EnsureThat;
using NzbDrone.Common.Extensions;
using NzbDrone.Common.Reflection;
using NzbDrone.Core.Annotations;
using Omu.ValueInjecter;
namespace NzbDrone.Api.ClientSchema
{
@@ -56,7 +55,7 @@ namespace NzbDrone.Api.ClientSchema
return result.OrderBy(r => r.Order).ToList();
}
public static object ReadFormSchema(List<Field> fields, Type targetType, object defaults = null)
public static object ReadFromSchema(List<Field> fields, Type targetType)
{
Ensure.That(targetType, () => targetType).IsNotNull();
@@ -64,11 +63,6 @@ namespace NzbDrone.Api.ClientSchema
var target = Activator.CreateInstance(targetType);
if (defaults != null)
{
target.InjectFrom(defaults);
}
foreach (var propertyInfo in properties)
{
var fieldAttribute = propertyInfo.GetAttribute<FieldDefinitionAttribute>(false);
@@ -146,9 +140,9 @@ namespace NzbDrone.Api.ClientSchema
}
public static T ReadFormSchema<T>(List<Field> fields)
public static T ReadFromSchema<T>(List<Field> fields)
{
return (T)ReadFormSchema(fields, typeof(T));
return (T)ReadFromSchema(fields, typeof(T));
}
private static List<SelectOption> GetSelectOptions(Type selectOptions)