瀏覽代碼

Fixed Linked Properties Error when creating unlinked Enclosed Entities
Added Cache ID for Repositories

Frank van den Bos 1 年之前
父節點
當前提交
4a18d0f07d
共有 2 個文件被更改,包括 11 次插入5 次删除
  1. 3 4
      InABox.Core/LinkedProperties.cs
  2. 8 1
      InABox.Mobile/InABox.Mobile.Shared/DataModels/CoreRepository.cs

+ 3 - 4
InABox.Core/LinkedProperties.cs

@@ -92,13 +92,12 @@ namespace InABox.Core
 
         public static bool Find(ISubObject subObject, string name, [NotNullWhen(true)] out ILinkedProperty? property, out BaseObject parent)
         {
+            property = null;
             parent = GetParent(subObject);
+            if (parent == null)
+                return false;
             if(!_LinkedProperties.TryGetValue(parent.GetType(), out var props))
-            {
-                property = null;
                 return false;
-            }
-
             var path = GetPath(subObject);
             property = props.FirstOrDefault(x => x.Path == path && x.Source == name);
             return property != null;

+ 8 - 1
InABox.Mobile/InABox.Mobile.Shared/DataModels/CoreRepository.cs

@@ -40,7 +40,14 @@ namespace InABox.Mobile
             Path.Combine(CacheFolder(), filename);
 
         public static string CacheFolder()
-            => Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
+        {
+            var result = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
+            if (CacheID != Guid.Empty)
+                result = Path.Combine(result,CacheID.ToString());
+            return result;
+        }
+
+        public static Guid CacheID { get; set; } 
 
     }