浏览代码

Fixed deleting objects with donotpersist properties

Kenric Nugteren 1 年之前
父节点
当前提交
cd5bc3e263
共有 1 个文件被更改,包括 3 次插入0 次删除
  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;