在收集OData的名单 [英] List of Collection Names in oData

查看:228
本文介绍了在收集OData的名单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有点糊涂了如何从以下ODATA服务得到收集名单http://services.odata.org/V4/Northwind/Northwind.svc/



我只是想获得所有可用集合的列表在服务名称,然后将我想要让用户选择该集合



例如,下面的行要查看的收集信息,然后显示项目访问到客户集合。

  VAR的客户= client.For(顾客)FindEntriesAsync()。 



我可以能够如下每一个集合的内部访问。

 静态无效的主要(字串[] args)
{

VAR的客户=新ODataClient(services.odata.org/罗斯文/ Northwind.svc /);

VAR的客户= client.For(客户)FindEntriesAsync();

的foreach(VAR的客户在客户){

Console.WriteLine(顾客[客户ID]);
}
}


解决方案

一我能想到的办法是:
当你获得这个页面的响应:的 http://services.odata.org/V4/Northwind/Northwind.svc/ 响应是一个Atom feed,你可以处理它作为一个Atom feed或XML,基本上加载XML和阅读的元素到你的代码,并利用它们从那里。


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.

这篇关于在收集OData的名单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆