1. To enable OData query options globally, call EnableQuerySupport on the
HttpConfiguration class at startup. Have you done this? The
EnableQuerySupport method enables query options globally for any controller action that returns an
IQueryable type. If you don’t want query options enabled for the entire application, you can enable them for specific controller actions by adding the
[Queryable] attribute to the action method.
None
0 Points
5 Posts
OData Controller returns 406 for types in dynamically generated assemblies
Apr 30, 2015 03:03 PM|Fardream1|LINK
Hi,
Thanks in advance.
I am trying to create a type with System.Reflection.Emit and set up the model by calling something like following:
And metadata returns correctly. However, when I try to query the data with a generic controller:
It returns 406 status code.
Any idea how I can rectify this issue?
Thanks
All-Star
15252 Points
2074 Posts
Re: OData Controller returns 406 for types in dynamically generated assemblies
May 04, 2015 10:36 PM|Krunal Parekh|LINK
Hello Fardream1,
1. To enable OData query options globally, call EnableQuerySupport on the HttpConfiguration class at startup. Have you done this? The EnableQuerySupport method enables query options globally for any controller action that returns an IQueryable type. If you don’t want query options enabled for the entire application, you can enable them for specific controller actions by adding the [Queryable] attribute to the action method.
You can follow this article to understand more.
Supporting OData Query Options in ASP.NET Web API 2
Hope this helps.
With Regards,
Krunal Parekh
MSDN Community Support
Please remember to "Mark as Answer" the responses that resolved your issue.
None
0 Points
5 Posts
Re: OData Controller returns 406 for types in dynamically generated assemblies
May 15, 2015 10:04 AM|Fardream1|LINK
Hi, Krunal,
Thanks for the reply but I don't think you are answering my question. I am asking that how to add support to classes that is generated on the fly.
All-Star
15252 Points
2074 Posts
Re: OData Controller returns 406 for types in dynamically generated assemblies
May 17, 2015 10:17 PM|Krunal Parekh|LINK
Hello Fardream1,
For this you could try posting this question at github odata issues https://github.com/OData/odata.net/issues. you are likely to get more response from there.
With Regards,
Krunal Parekh
MSDN Community Support
Please remember to "Mark as Answer" the responses that resolved your issue.