Skip to content

Commit

Permalink
Fix: MemberType sync removes well known membertype properties
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Jump committed Aug 5, 2020
1 parent 213bd44 commit 6ccf84e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,7 @@ protected void DeserializeProperties(TObject item, XElement node)
var alias = propertyNode.Element("Alias").ValueOrDefault(string.Empty);
if (string.IsNullOrEmpty(alias)) continue;


var key = propertyNode.Element("Key").ValueOrDefault(Guid.Empty);
var key = propertyNode.Element("Key").ValueOrDefault(alias.GetHashCode().ToGuid());
var definitionKey = propertyNode.Element("Definition").ValueOrDefault(Guid.Empty);
var propertyEditorAlias = propertyNode.Element("Type").ValueOrDefault(string.Empty);

Expand Down Expand Up @@ -672,11 +671,10 @@ private void RemoveProperties(IContentTypeBase item, XElement properties)
List<string> removals = new List<string>();

var nodes = properties.Elements("GenericProperty")
.Where(x => x.Element("Key").ValueOrDefault(Guid.Empty) != Guid.Empty)
.Select(x =>
new
{
Key = x.Element("Key").ValueOrDefault(Guid.Empty),
Key = (x.Element("Key").ValueOrDefault(Guid.NewGuid()) == Guid.Empty ? Guid.NewGuid() : x.Element("Key").ValueOrDefault(Guid.NewGuid())),
Alias = x.Element("Alias").ValueOrDefault(string.Empty)
})
.ToDictionary(k => k.Key, a => a.Alias);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ protected override XElement SerializeProperties(IMemberType item)
var alias = property.Element("Alias").ValueOrDefault(string.Empty);
if (!string.IsNullOrWhiteSpace(alias) && buildInProperties.InvariantContains(alias))
{
property.Element("Key").Value = Guid.Empty.ToString();
property.Element("Key").Value = alias.GetHashCode().ToGuid().ToString();
}
}
return node;
Expand Down

0 comments on commit 6ccf84e

Please sign in to comment.