Search code examples
asp.net-web-apiodata

How to configure a named resource stream using OData in ASP.NET Web API


I am creating OData endpoints using ASP.NET Web API using v5.8.0 of this NuGet package. I have everything working and I can retrieve simple data such as strings and ints without an issue. However I would now like to extend one of the endpoints so that one of the items that can be retrieved is a binary image file. Having read up on OData I have decided to use named resource streams to achieve this.

The problem I have is that I can find very little information on how to implement this using the ODataController. The closest I can find is this blog post but it is using an older version of Web API and the code does not compile when I use it in my project.

So can somebody please supply a working example of how this should be implemented please.


Solution

  • Named streams (aka stream properties) are not currently supported in Web API OData (for OData v4). See the following issues: