0
votes

I am currently working on an OData Web API 2 service using EF6 with a code first approach. My controllers all derive from the base ODataController. I have made use of Ninject for DI and Owin.

I am trying to expose OData but for some strange reason on using the EDMBuilder, content negotiation fails even on a browser, giving the HTTP 406 error.

Content negotiation works when I use the ODataConventionModelBuilder, but I cannot use this as I will not be able to use breeze's client side features.

Wondering if anyone has come across such an issue before while using the EDMBuilder.

1
Can this behavior be due to the use of OWIN startup. I developed a similar application with the normal web api2 template and it works fine with the ODataController and EdmBuilder. - chirag kalyanpur
Finally found the problem, looks like the EdmBuilder internally uses the EdmxReader to generate the IEdmModel. The namespaces for my DBcontext and Model classes are different, but the EdmxReader appears to take the namespace of my DbContext only and assigns it even to my Models. Is there a way I can change this? or any alternate way to solve this? - chirag kalyanpur

1 Answers

0
votes

Looks like this is documented :(. It is there in the Breeze documentation at the following link with a suggested workaround: http://www.breezejs.com/documentation/odata-server