Explorar o código

Fixed deleting objects with donotpersist properties

Kenric Nugteren hai 1 ano
pai
achega
cd5bc3e263
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  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;