I'm using these packages:
<package id="Microsoft.AspNet.Mvc" version="5.0.0" targetFramework="net45" />
<package id="Microsoft.AspNet.Razor" version="3.0.0" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi" version="5.2.3" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.OData" version="5.7.0" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.3" targetFramework="net45" />
<package id="Microsoft.AspNet.WebPages" version="3.0.0" targetFramework="net45" />
<package id="Microsoft.Data.Edm" version="5.6.0" targetFramework="net45" />
<package id="Microsoft.Data.OData" version="5.6.0" targetFramework="net45" />
I inserted an ODataController using this technique:
- Right-click on Controller folder, "Add Controller"
- Choose from "Add Scaffold" list the "Web API 2 ODataController with actions, using Entity Framework"
- Choose the appropriate Model and context for this ODataController
- Modify WebApiConfig.cs according to the inserted template
When I hit my controller, the result does not include the @odata.context
property, which throws off the angular-odataresources library I'm using
The response only includes these two properties:
{odata.metadata: "...", value: [...]}
How can I make the ODataController respond with @odata.context property?
I tried using this, but no change in response:
$format=application/json;
odata.metadata=full
Update
I just found this link Specifically:
The name of the odata.context annotation is "odata.metadata" and is written without the leading "@"
Does this mean I cannot make ODataController return @odata.context
?
As a workaround I can always change the Javascript which is thrown off.