I am trying to adapt this example to create a simple OData client. Before that, I added a service reference in Visual Studio to "http://services.odata.org/Northwind/Northwind.svc/".
By this step I got many classes like "Alphabetical_list_of_product". But how do I get the alphabetical list of products, for example?
Specifically, in the example the author just starts with:
OdataClient.NorthwindOdataService.NorthwindEntities dc =
new OdataClient.NorthwindOdataService.NorthwindEntities(
new Uri("http://services.odata.org/Northwind/Northwind.svc/"));
But where did he get the OdataClient.NorthwindOdataService.NorthwindEntities
class from?
I am new to web services and OData, so apologies if the question is vague.
If you want a client for consuming OData service, a good choice should be OData code generator. You can start by reading the tutorial http://blogs.msdn.com/b/odatateam/archive/2014/03/12/how-to-use-odata-client-code-generator-to-generate-client-side-proxy-class.aspx .
Here is an example of how the service reference can be used after it has been added to the project:
As you are new to OData, it is recommended that you start from OData V4. Add Service Reference supports client side proxy generation of OData service up to OData V3. The OData V4 protocol on OASIS Comittee and the blog of the OData team of Microsoft can be referred to for details.