I´m trying to use System.Web.Http.OData.Delta to implement PATCH methods in ASP.NET Web API services, but it seems unable to apply changes to properties of type IEnumerable.
This is my code:
public class Person
{
[Required]
public string Name { get; set; }
public IList<Document> AdditionalDocuments { get; set; }
public HomeAddress HomeAddress { get; set; }
}
public class HomeAddress
{
public string StreetName { get; set; }
}
public class Document
{
public string Value { get; set; }
}
The patch is implemented like this:
[AcceptVerbs("PATCH")]
public void Patch(string id, Delta<Person> delta)
{
var person = personRepository.GetById(id)
delta.Patch(person);
}
My problem is that when i patch the informations, the HomeAddress and the AdditionalDocuments are being ignored. I found another article(How do I patch enumerables with System.Web.Http.OData.Delta?) here, but i couldn´t implement the solution because i didn´t know how to internalize the Delta code. May someone help me?