This project is read-only.


Document dependency between EntitySetController.CreateEntity and GetKey methods


If you override CreateEntity and do not override GetKey, you get an obscure error when calling the service:
"code":"POST requests are not supported.","message":{
  "lang":"en-US","value":"Extracting the key from entity instances is not supported for this entity set."
This is because CreateEntity calls GetKey under the covers. The XML Doc comments on CreateEntity should document the dependency and the fact that you have to override both.


HongmeiG wrote Feb 15, 2013 at 1:42 AM

In addition to documentation, we should also look at coming up with some default implementation so that user don't have to run into this in the first place.

jacalvar wrote Apr 15, 2013 at 7:29 PM

1) A more meaningful error suggesting to implement GetKey would be good.

2) A default implementation could be to figure out the key from the model and using that information to extract it from the entity.

eilonlipton wrote Jun 20, 2013 at 10:55 PM

Let's just update the XML documentation on this to make it clearer how to use it.