Differente between AppendAddOp and AppendReplaceOp

Gökhan Kurt 106 Reputation points
2020-11-10T10:54:40.047+00:00

Azure.DigitalTwins.Core.Serialization.UpdateOperationsUtility contains two methods

AppendAddOp and AppendReplaceOp.

As far as i see Add behaves exactly like Replace

Add method you would expect it to add the path as well as value but it will probably not do that if the path is not already defined in the metadata.
Then the question is what is the difference.
By the way I am expecting both to generate a Microsoft.DigitalTwins.Twin.Update event but seems like Replace is not

Azure Digital Twins
Azure Digital Twins
An Azure platform that is used to create digital representations of real-world things, places, business processes, and people.
231 questions
{count} votes

1 answer

Sort by: Most helpful
  1. QuantumCache 20,271 Reputation points
    2020-11-12T19:04:51.567+00:00

    Hello @Gökhan Kurt

    Below is the response from Microsoft Product Team on your query.

    You might be using the preview SDK version.

    It is the difference between adding a new property to a twin, and replacing the current property value on a twin.

    For GA, the new helper class is JsonPatchDocument instead: Docs/.NET API Browser/Microsoft.AspNetCore.JsonPatch/JsonPatchDocument

    Please let us know if you need further help in this matter.

    Thank you,
    Satish


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.