diff --git a/uSync8.Core/Serialization/Serializers/DataTypeSerializer.cs b/uSync8.Core/Serialization/Serializers/DataTypeSerializer.cs index 890e902b..b8acbf43 100644 --- a/uSync8.Core/Serialization/Serializers/DataTypeSerializer.cs +++ b/uSync8.Core/Serialization/Serializers/DataTypeSerializer.cs @@ -45,8 +45,11 @@ protected override SyncAttempt DeserializeCore(XElement node) if (item == null) throw new ArgumentException($"Cannot find underling datatype for {name}"); // basic - item.Name = name; - item.Key = key; + if (item.Name != name) + item.Name = name; + + if (item.Key != key) + item.Key = key; var editorAlias = info.Element("EditorAlias").ValueOrDefault(string.Empty); if (editorAlias != item.EditorAlias) @@ -63,7 +66,9 @@ protected override SyncAttempt DeserializeCore(XElement node) // and can change based on minor things (so gives false out of sync results) // item.SortOrder = info.Element("SortOrder").ValueOrDefault(0); - item.DatabaseType = info.Element("DatabaseType").ValueOrDefault(ValueStorageType.Nvarchar); + var dbType = info.Element("DatabaseType").ValueOrDefault(ValueStorageType.Nvarchar); + if (item.DatabaseType != dbType) + item.DatabaseType = dbType; // config DeserializeConfiguration(item, node); @@ -96,20 +101,35 @@ private void DeserializeConfiguration(IDataType item, XElement node) if (!string.IsNullOrWhiteSpace(config)) { - var serializer = this.configurationSerializers.GetSerializer(item.EditorAlias); if (serializer == null) { - item.Configuration = JsonConvert.DeserializeObject(config, item.Configuration.GetType()); + var configObject = JsonConvert.DeserializeObject(config, item.Configuration.GetType()); + if (!IsJsonEqual(item.Configuration, configObject)) + item.Configuration = configObject; } else { logger.Debug("Deserializing Config via {0}", serializer.Name); - item.Configuration = serializer.DeserializeConfig(config, item.Configuration.GetType()); + var configObject = serializer.DeserializeConfig(config, item.Configuration.GetType()); + if (!IsJsonEqual(item.Configuration, configObject)) + item.Configuration = configObject; } } } + /// + /// tells us if the json for an object is equal, helps when the config objects don't have their + /// own Equals functions + /// + private bool IsJsonEqual(object currentObject, object newObject) + { + var currentString = JsonConvert.SerializeObject(currentObject, Formatting.None); + var newString = JsonConvert.SerializeObject(newObject, Formatting.None); + + return currentString == newString; + } + /////////////////////// diff --git a/uSync8.Site/config/uSync8.config b/uSync8.Site/config/uSync8.config index 3787d64d..8087c054 100644 --- a/uSync8.Site/config/uSync8.config +++ b/uSync8.Site/config/uSync8.config @@ -12,7 +12,7 @@ False - +