I am little of confused how to get list of collection names from the following odata service http://services.odata.org/V4/Northwind/Northwind.svc/
I just want to get a list of all of the available collection names in the service And then I'd like to let the user choose which collection to view information for, and subsequently show items in that collection
For example, the following line accessing to Customers
collection.
var customers = client.For("Customers").FindEntriesAsync();
I could able to access inside of each collection as follows.
static void Main(string[] args)
{
var client = new ODataClient("services.odata.org/Northwind/Northwind.svc/");
var customers = client.For("Customers").FindEntriesAsync();
foreach (var customer in customers) {
Console.WriteLine(customer["CustomerID"]);
}
}
One way that I can think of is: When you get the response of this page: http://services.odata.org/V4/Northwind/Northwind.svc/ the response is an Atom feed and you can deal with it as an ATOM Feed or XML and basically load the XML and read the elements into your code and use them from there.
来源:https://stackoverflow.com/questions/29996406/list-of-collection-names-in-odata