From 5b9c82480e56fbef11dd120c2cccc04d0999c644 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Mon, 25 Jan 2021 20:50:18 +0100 Subject: [PATCH] Fixing usless modifications of related items --- Kyoo.Common/Models/Attributes/EditableRelation.cs | 1 + Kyoo.CommonAPI/LocalRepository.cs | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Kyoo.Common/Models/Attributes/EditableRelation.cs b/Kyoo.Common/Models/Attributes/EditableRelation.cs index 78b479e9..4275dca4 100644 --- a/Kyoo.Common/Models/Attributes/EditableRelation.cs +++ b/Kyoo.Common/Models/Attributes/EditableRelation.cs @@ -2,5 +2,6 @@ using System; namespace Kyoo.Models.Attributes { + [AttributeUsage(AttributeTargets.Property, Inherited = false)] public class EditableRelation : Attribute { } } \ No newline at end of file diff --git a/Kyoo.CommonAPI/LocalRepository.cs b/Kyoo.CommonAPI/LocalRepository.cs index 8cb6b794..4927da83 100644 --- a/Kyoo.CommonAPI/LocalRepository.cs +++ b/Kyoo.CommonAPI/LocalRepository.cs @@ -231,10 +231,9 @@ namespace Kyoo.Controllers foreach (PropertyInfo property in typeof(T).GetProperties() .Where(x => typeof(IEnumerable).IsAssignableFrom(x.PropertyType) - && !typeof(string).IsAssignableFrom(x.PropertyType))) + && !typeof(string).IsAssignableFrom(x.PropertyType) + && x.GetCustomAttribute() != 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); if (value == null || value is ICollection || Utility.IsOfGenericType(value, typeof(ICollection<>))) continue;