0

I am trying to fetch all the data for Customer. However, await mODataClient.For ("Customers").Skip (0).FindEntriesAsync() returns null. I could not able to figure out what I am doing wrong. I am trying to get Northwind Customer data

  using Simple.OData.Client;
  private IEnumerable <IDictionary<string,object>> myCustomers;

  mODataClient = new ODataClient ("http://services.odata.org/Northwind/Northwind.svc/");

  try 
    {
        myCustomers =await mODataClient.For ("Customers").Skip (0).FindEntriesAsync();
    }
 catch 
    {
        await DisplayAlert("Error", "Connection Error", "OK", "Cancel");

    }
casillas
  • 16,351
  • 19
  • 115
  • 215
  • 1
    I wrote a similar console application and it works well requesting the same base URL and the same entity set as you did. Can you try adding a "foreach" block to enumerate through every item in "myCustomers" and try to print their "CustomerID"? – Yi Ding - MSFT Oct 16 '14 at 02:57
  • since myCustomers is null, it crashes when it attempts to run foreach block. – casillas Oct 16 '14 at 03:25
  • Weird, I wrote the following console application and it worked like a charm and it's basically the same as yours: – Yi Ding - MSFT Oct 16 '14 at 05:58
  • 1
    static void Main(string[] args) { var client = new ODataClient("http://services.odata.org/Northwind/Northwind.svc/"); var customers = client.For("Customers").Skip(0).FindEntriesAsync().Result; foreach (var customer in customers) { Console.WriteLine(customer["CustomerID"]); } } – Yi Ding - MSFT Oct 16 '14 at 05:59
  • @YiDing-MSFT Any idea of the following question :http://stackoverflow.com/questions/29996406/fecthing-collections-in-odata – casillas May 01 '15 at 23:06

0 Answers0