mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-07-09 03:04:20 -04:00
Fixing usless modifications of related items
This commit is contained in:
parent
3f5a0c060c
commit
5b9c82480e
@ -2,5 +2,6 @@ using System;
|
|||||||
|
|
||||||
namespace Kyoo.Models.Attributes
|
namespace Kyoo.Models.Attributes
|
||||||
{
|
{
|
||||||
|
[AttributeUsage(AttributeTargets.Property, Inherited = false)]
|
||||||
public class EditableRelation : Attribute { }
|
public class EditableRelation : Attribute { }
|
||||||
}
|
}
|
@ -231,10 +231,9 @@ namespace Kyoo.Controllers
|
|||||||
|
|
||||||
foreach (PropertyInfo property in typeof(T).GetProperties()
|
foreach (PropertyInfo property in typeof(T).GetProperties()
|
||||||
.Where(x => typeof(IEnumerable).IsAssignableFrom(x.PropertyType)
|
.Where(x => typeof(IEnumerable).IsAssignableFrom(x.PropertyType)
|
||||||
&& !typeof(string).IsAssignableFrom(x.PropertyType)))
|
&& !typeof(string).IsAssignableFrom(x.PropertyType)
|
||||||
|
&& x.GetCustomAttribute<EditableRelation>() != null))
|
||||||
{
|
{
|
||||||
// TODO For DE classes (like ShowDE), the basic ienumerable should not be verified (for exemple, GenreLinks should be checked & not Genres).
|
|
||||||
Console.WriteLine($"Validating {property.Name}");
|
|
||||||
object value = property.GetValue(resource);
|
object value = property.GetValue(resource);
|
||||||
if (value == null || value is ICollection || Utility.IsOfGenericType(value, typeof(ICollection<>)))
|
if (value == null || value is ICollection || Utility.IsOfGenericType(value, typeof(ICollection<>)))
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user