Forráskód Böngészése

Fix to duplciate key bug

Kenric Nugteren 1 éve
szülő
commit
0c88a0a3f9
1 módosított fájl, 7 hozzáadás és 2 törlés
  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)