odata controller. Correct why to implement get by key -


this question has answer here:

i have adapted pattern pluralsight course. because of ability return correct http codes.

public virtual ihttpactionresult get(int key) {     iqueryable<t> result = repository.asqueryable().where(p => p.id == key);      if (!result.any())         return notfound();      return ok(singleresult.create(result)); } 

the problem in return format.

{    "@odata.context":"https://localhost:44300/odata/$metadata#reports/$entity","id":1,"name":"test report#1","description":"min f\u00f8rste rapport","categorytypeid":1,"organizationid":1,"definition":null,"accessmodifier":"local","objectownerid":1,"lastchanged":"2016-08-18t12:57:48.3735722+02:00","lastchangedbyuserid":1 } 

it's mix of context meta data , entity properties in same json object. there nothing wrong according microsoft it's hard work with.

is there way correct behaviour?

if add accept header application/json; odata.metadata=none metadata stripped.


Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -