Say I have a very simple type which I\'d like to expose on an OData feed as part of a collection using a .NET C# webapi controller:
public class Image
{
There are extension points on how the serialization is done in Web API Odata
Here is an example.
customizing odata output from asp.net web api
Though the question was different, I guess what you want could be done using the same approach (i.e. overriding how the entries are serialized.)
Especially, in the overridden CreateEntry you may change entry.Properties
(Note that this version is not released yet AFAIK but could be downloaded as a prerelease version.)
Not really a solution to your problem but hope this helps.
This is one of the top features in our backlog. We tend to call it 'Typeless support' internally in our team while referring it.
The problem with web API is that it requires a strong CLR type for each and every EDM type that the service is exposing. Also, the mapping between the CLR type and the EDM type is one-to-one and not configurable. This is also how most IQueryable implementations work too.
The idea with typeless support is to break that requirement and provide support for having EDM types without a backing strong CLR type. For example, all your EDM entities can be backed by a key-value dictionary.