diff --git a/Jumoo.uSync.Core/Helpers/uSyncValueMapper.cs b/Jumoo.uSync.Core/Helpers/uSyncValueMapper.cs index 139d74da..27f99e4b 100644 --- a/Jumoo.uSync.Core/Helpers/uSyncValueMapper.cs +++ b/Jumoo.uSync.Core/Helpers/uSyncValueMapper.cs @@ -244,7 +244,7 @@ public string MapToId(XElement valueNode, PreValue preVal) // at the end we remove the zzusync Regex regx = new Regex(@"\d+"); - var value = regx.Replace(valueNode.Attribute("Value").Value, "$0:zzusync"); + var value = regx.Replace(valueNode.Value, "$0:zzusync"); var mapGuid = valueNode.Attribute("MapGuid"); if (mapGuid == null) diff --git a/Jumoo.uSync.Core/Serializers/DataTypeSerializer.cs b/Jumoo.uSync.Core/Serializers/DataTypeSerializer.cs index e1551b1b..b8706e50 100644 --- a/Jumoo.uSync.Core/Serializers/DataTypeSerializer.cs +++ b/Jumoo.uSync.Core/Serializers/DataTypeSerializer.cs @@ -178,7 +178,6 @@ internal override SyncAttempt DesearlizeSecondPassCore(IDat private XElement DeserializeGetMappedValues(XElement node, IDictionary preValues ) { - XElement nodeCopy = new XElement(node); var id = nodeCopy.Attribute("Id").ValueOrDefault(string.Empty); @@ -188,6 +187,12 @@ private XElement DeserializeGetMappedValues(XElement node, IDictionary x.Attribute("Value") != null)) + { + legacyElement.Value = legacyElement.Attribute("Value").Value; + } + if (mapper != null && preValuesElements != null && preValuesElements.HasElements) { foreach (var preValueNode in preValuesElements.Descendants() @@ -203,7 +208,8 @@ private XElement DeserializeGetMappedValues(XElement node, IDictionary("Setting Mapped Value: {0}", () => value); - preValueNode.Attribute("Value").Value = value; + preValueNode.Value = value; + // preValueNode.Attribute("Value").Value = value; } preValueNode.Attribute("MapGuid").Remove(); @@ -239,9 +245,9 @@ private void DeserializeUpdatePreValues(IDataTypeDefinition item, XElement node) if (preValNode != null) { // set the value of preValue value to the value of the value attribute :) - if (preValue.Value.Value != preValNode.Attribute("Value").Value) + if (preValue.Value.Value != preValNode.Value) { - preValue.Value.Value = preValNode.Attribute("Value").Value; + preValue.Value.Value = preValNode.Value; } } else @@ -268,7 +274,7 @@ private void DeserializeUpdatePreValues(IDataTypeDefinition item, XElement node) foreach (var nodeValue in preValueRootNode.Elements("PreValue")) { var alias = nodeValue.Attribute("Alias").ValueOrDefault(string.Empty); - var value = nodeValue.Attribute("Value").ValueOrDefault(string.Empty); + var value = nodeValue.ValueOrDefault(string.Empty); if (!string.IsNullOrEmpty(alias)) { @@ -333,8 +339,8 @@ private XElement SerializePreValues(IDataTypeDefinition item, XElement node) var preValueValue = preValue.Value; XElement preValueNode = new XElement("PreValue", - new XAttribute("Id", preValue.Id.ToString()), - new XAttribute("Value", String.IsNullOrEmpty(preValueValue) ? "" : preValueValue)); + new XAttribute("Id", preValue.Id.ToString())); + preValueNode.Add(new XCData(String.IsNullOrEmpty(preValueValue) ? "" : preValueValue)); if (!itemPreValuePair.Key.StartsWith("zzzuSync")) preValueNode.Add(new XAttribute("Alias", itemPreValuePair.Key));