Преглед на файлове

Fix to duplciate key bug

Kenric Nugteren преди 1 година
родител
ревизия
0c88a0a3f9
променени са 1 файла, в които са добавени 7 реда и са изтрити 2 реда
  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)