public HttpResponseMessage Patch(Guid menuItemId, JsonPatchDocument<MenuItem> patchData)
{
//Validation and other things
patchData.ApplyUpdatesTo(menuItemEntity);
dbContext.SaveChanges();
//more irrelevant code for this example here
}
The above will in fact replace the value of the Name property of the entity to "Foo" but instead of replacing the value of the SiteMenuItemExclusion property it will add that SiteId to it.
Let me explain the issue with an example: Client data being sent to server:
Server side code:
The above will in fact replace the value of the
Name
property of the entity to "Foo" but instead of replacing the value of theSiteMenuItemExclusion
property it will add that SiteId to it.I also tried:
But that does not seem to work.