mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-16 10:03:51 -07:00
embedded type convector is now registered for all embedded types automatically.
This commit is contained in:
parent
bdcdc7c0f6
commit
c1fba9093d
5 changed files with 42 additions and 24 deletions
|
@ -2,6 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Marr.Data;
|
||||
using Marr.Data.Mapping;
|
||||
|
||||
namespace NzbDrone.Core.Datastore
|
||||
|
@ -25,19 +26,18 @@ namespace NzbDrone.Core.Datastore
|
|||
|
||||
if (propertyInfo == null) return false;
|
||||
|
||||
if (propertyInfo.PropertyType.GetInterfaces().Any(i => i == typeof(IEmbeddedDocument)))
|
||||
|
||||
if (!propertyInfo.IsReadable() || !propertyInfo.IsWritable())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (IsSimpleType(propertyInfo.PropertyType) || MapRepository.Instance.TypeConverters.ContainsKey(propertyInfo.PropertyType))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (typeof(IEnumerable<IEmbeddedDocument>).IsAssignableFrom(propertyInfo.PropertyType))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
var result = propertyInfo.IsReadable() && propertyInfo.IsWritable() && IsSimpleType(propertyInfo.PropertyType);
|
||||
|
||||
return result;
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool IsSimpleType(Type type)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue