This project is read-only.

CreateEntity returns wrong location header

Topics: ASP.NET Web API
Jun 2, 2013 at 3:39 PM

I have a web api odata controller that impl' CreateEntity. After creating an entity and returning it, the entity in the body of the HTTP respond contains the new entity with the ID it was given, however the location header returns the correct uri with incorrect id with value -1, something like:

Location: http://localhost:53809/odata/<Entityname>(-1) how can I manually set the ID, or make the web api odata returns the correct id? Thanks.
Jun 29, 2013 at 6:36 AM
I believe the key is determined by your implementation of the GetKey method on your EntitySetController.

Daniel Roth