Search code examples
c#odata

oData C# example code not compiling. Very basic


I am trying to get an oData Client to work, using the C# library Simple.OData.Client

As can be seen at http://www.odata.org/

var client = new ODataClient("http://services.odata.org/v4/TripPinServiceRW/");

var people = await client.For<People>().FindEntriesAsync();

These 2 lines are supposed to request a resource from the Server, but I can't compile this, as "People isn't being recognized. I have seen the specific notation .For<People>() in several oData examples, but no one ever explains or even mentions the "People" part.

What am I missing?


Solution

  • From the Getting started with Simple.OData.Client, it mentions that:

    Example of typed fluent API syntax (assuming there is a class Package defined )

    So, you should define the "People" CLR class first, then you can use it in the sample code.

    I tried it out and it works fine. You can find my sample project Here