Using OData in webapi for properties known only at runtime

前端 未结 2 997
我在风中等你
我在风中等你 2020-12-30 09:09

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
{
             


        
2条回答
  •  情话喂你
    2020-12-30 09:40

    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.

提交回复
热议问题