How can you produce ATOM formatted output in an ASP.NET WebApi 2.2 ODATA service? Creating the JSON version, or the simple XML format is easy. But no matter how I request the Content-Type, I always get the 1st format in the configuration. (Using PostMan for Chrome, or setting the Request's Content-Type in the producer method.)
If I use WCF Data Service, I get ATOM formatted result. But as far as I understand, the ODATA v4 is only implemented in WebApi, not in WCF. So, it seems a bit odd, that I can't format it any way I like...
My configuration code is the basic:
config.MapODataServiceRoute(
routeName: "ODataRoute",
routePrefix: null,
model: builder.GetEdmModel());
Thanks,
AntiTalent
UPDATE: Using the typical solution found on the net (link from 1st comment, @mdisibrio), I get this (WebApi 2.2):
<ODataServiceDocument
xmlns:i="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://schemas.datacontract.org/2004/07/Microsoft.OData.Core">
<EntitySets>
<ODataEntitySetInfo>
<Name>Projects</Name>
<Title i:nil="true"/>
<Url>Projects</Url>
</ODataEntitySetInfo>
</EntitySets>
<FunctionImports/>
<Singletons/>
</ODataServiceDocument>
But what I would like to get is (WCF Data Service):
<service xmlns="http://www.w3.org/2007/app"
xmlns:atom="http://www.w3.org/2005/Atom"
xml:base="http://MYSERVER/Service.svc/">
<workspace>
<atom:title>Default</atom:title>
<collection href="ProjectList">
<atom:title>ProjectList</atom:title>
</collection>
</workspace>
</service>
Yes, I'm fully aware, that the entities have different names. It's not what my issue is.