Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot serialize EdmDeltaComplexObject in odata 7x and above #1064

Closed
xuzhg opened this issue Oct 2, 2023 · 0 comments · Fixed by #1065
Closed

Cannot serialize EdmDeltaComplexObject in odata 7x and above #1064

xuzhg opened this issue Oct 2, 2023 · 0 comments · Fixed by #1065
Labels
bug Something isn't working

Comments

@xuzhg
Copy link
Member

xuzhg commented Oct 2, 2023

Copied from: OData/WebApi#2806

ODataResourceSerializer fails to serialize resource of type EdmDeltaComplexObject for Delta entities.

Assemblies affected

OData 7x and above

Reproduce steps

While trying to serialize the resource of type EdmDeltaComplexObject

public class Sample
{
    public string Description
    {  get; set;  }

    public SampleItemCollection Samplelist
    {  get; set;  }
}

public class SampleItemCollection : EdmDeltaComplexObject
{
     public IDictionary<string, object> DynamicProperties { get; set; }
}

When an instance of the above Sample class is edited and a delta sync request is sent to fetch the changes,
Expected response is:

{
  ""samplelist"": {
    ""key-samplelist"": {
      ""title"": ""Title"",
    }
  },
  ""description"": "an edit to sample item"
}

Actual response seen in v7x:

{
  ""samplelist"": {
  },
  ""description"": "an edit to sample item"
}

Additional detail

Reasoning:
In OData V5x & 6x Complex type property is treated as a struct property, and serialization for a complex property was performed similar to primitive property.
however, in OData v7x, complex properties are treated as a resource and classified as DynamicComplexProperties.

It looks like a feature gap/regression bug and solution would be to call the WriteDynamicComplexProperties for delta entities.

@xuzhg xuzhg added the bug Something isn't working label Oct 2, 2023
xuzhg added a commit that referenced this issue Oct 11, 2023
…ect (#1065)

* Fixes #1064, enable to write dynamic properties for changed/delta objects

* Change the copy right
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant