Reputation: 249
Rather than expose my Database Model I'm trying to get my WebAPI endpoints working with DTO equivalents. In my WebAPIConfig referenced from the Global.asax file I have:
builder.EntitySet<ProductDTO>("Products");
builder.EntitySet<Product>("ProductsDB");
Where Product has an extra field that ProductDTO does not have.
My patch request is currently:
[AcceptVerbs("PATCH", "MERGE")]
public IHttpActionResult Patch([FromODataUri] int key, Delta<ProductDTO> patch)
{
I can see that essentially I need to convert my Delta<ProductDTO>
into a Delta<Product>
but I cannot see any methods in the Delta class that would allow me to set its underlying EntityType instance.
Does anyone have any advice?
Upvotes: 5
Views: 1629
Reputation: 3347
This question is very similar to yours, please reference it:
Microsoft Odata api through a ViewModel has problems in PATCH
Upvotes: 0