Skip to content

Commit

Permalink
Pass content and options to GetPropertyValue method. (Jumoo/uSync.Com…
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinJump committed Nov 26, 2024
1 parent fc03760 commit 853e197
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions uSync.Core/Serialization/Serializers/ContentSerializerBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -256,12 +256,12 @@ protected virtual XElement SerializeProperties(TObject item, SyncSerializerOptio
validNode = true;
}

if (validNode)
{
valueNode.Add(new XCData(GetExportValue(GetPropertyValue(value), property.PropertyType, value.Culture, value.Segment)));
elements.Add(valueNode);
}
if (validNode)
{
valueNode.Add(new XCData(GetExportValue(GetPropertyValue(item, value, options), property.PropertyType, value.Culture!, value.Segment!)));
elements.Add(valueNode);
}
}


if (includeDefaults)
Expand Down Expand Up @@ -303,9 +303,13 @@ protected virtual XElement SerializeProperties(TObject item, SyncSerializerOptio
return node;
}

// allows us to switch between published / edited easier.
protected virtual object GetPropertyValue(IPropertyValue value)
=> value.EditedValue;
// allows us to switch between published / edited easier.
protected virtual object GetPropertyValue(TObject content, IPropertyValue value, SyncSerializerOptions options)
=> value.EditedValue;

[Obsolete("Use Get Property value with content and options, will be removed in v17")]
protected virtual object GetPropertyValue(IPropertyValue value)
=> value.EditedValue;

protected override SyncAttempt<TObject> CanDeserialize(XElement node, SyncSerializerOptions options)
{
Expand Down

0 comments on commit 853e197

Please sign in to comment.