Kaynağa Gözat

Fix to duplciate key bug

Kenric Nugteren 1 yıl önce
ebeveyn
işleme
0c88a0a3f9
1 değiştirilmiş dosya ile 7 ekleme ve 2 silme
  1. 7 2
      InABox.Core/DatabaseSchema/DatabaseSchema.cs

+ 7 - 2
InABox.Core/DatabaseSchema/DatabaseSchema.cs

@@ -256,8 +256,13 @@ namespace InABox.Core
             {
                 properties = ImmutableDictionary<string, IProperty>.Empty;
             }
-            _properties[master] = properties.AddRange(
-                toAdd.Select(x => new KeyValuePair<string, IProperty>(x.Name, x)));
+            var newDict = properties.ToDictionary(x => x.Key, x => x.Value);
+            foreach(var prop in toAdd)
+            {
+                newDict[prop.Name] = prop;
+            }
+
+            _properties[master] = newDict.ToImmutableDictionary();
         }
         
         public static void RegisterProperty(IProperty entry)