Pārlūkot izejas kodu

Fixed deleting objects with donotpersist properties

Kenric Nugteren 1 gadu atpakaļ
vecāks
revīzija
cd5bc3e263
1 mainītis faili ar 3 papildinājumiem un 0 dzēšanām
  1. 3 0
      InABox.Core/Deletion.cs

+ 3 - 0
InABox.Core/Deletion.cs

@@ -2,6 +2,7 @@
 using System;
 using System.Collections.Generic;
 using System.Linq;
+using System.Reflection;
 using System.Text;
 using System.Threading.Tasks;
 
@@ -32,6 +33,8 @@ namespace InABox.Core
         private static bool IsDeletionColumn(IProperty property)
         {
             if (property.IsCalculated) return false;
+            if (property is StandardProperty standardProperty && standardProperty.Property.GetCustomAttribute<DoNotPersist>() != null)
+                return false;
             if (property.Parent is null) return true;
             if (property.Parent.IsEntityLink && !property.Name.EndsWith(".ID")) return false;
             if (property.Parent.HasParentEntityLink()) return false;