Q:

Manipulate Windows Azure Mobile Services table

I am trying to build a windows store app in C# that manipulates an azure mobile services table. I saw the tutorial, but I found myself in some errors:
1.  I cannot read data, I think I did not understand the tutorial at all. I can modify that TodoItem table, but when it comes to a different table (from azure mobile services of course), I cannot read it:
My C# code:
using Microsoft.WindowsAzure.MobileServices;
using Newtonsoft.Json;

public class myTable
{
    [JsonProperty(PropertyName = "column1")]
    public string column1 { get; set; }

    [JsonProperty(PropertyName = "column2")]
    public string column2 { get; set; }
}

public MobileServiceCollection<myTable, myTable> collection;
public IMobileServiceTable<myTable> table = App.MobileService.GetTable<myTable>();
public static MobileServiceClient client = new MobileServiceClient(
        "https://myMobileService.azure-mobile.net",
        "xxxxxxxxxxxxxxxxxxxxxxxxxx"
);

//at this point I am pretty much lost... :s ...

The guy from the azure tutorial uses the following method
to query at the TodoItem table, but I still don't get it...
Where does the todoItem came from, I can't see any Initialize for it??  Now, how can I perform a query using own my code????
 private async void RefreshTodoItems()
 {                       
  // This query filters out completed TodoItems. 
  items = await todoTable
   .Where(todoItem => todoItem.Complete == false)
   .ToCollectionAsync();

  ListItems.ItemsSource = items;
 }

I am kind of lost here, thanks for your help.

A:

There are a few things you'll need. First, the type you use for the table (in your case, myTable) should have an 'id' field.
public class myTable
{
    [JsonProperty("id")]
    public string Id { get; set; }

    [JsonProperty("column1")]
    public string Column1 { get; set; }

    [JsonProperty("column2")]
    public string Column2 { get; set; }
}

Now, to your specific question:

Where does the todoItem came from, I can't see any Initialize for it?? 

What is passed to the Where method is a lambda expression (todoItem => todoItem.Complete == false). You can read it as "for all elements in the table, which I'll call 'todoItem', give me those which Complete property of that element is false". Internally that is translated into a query which is sent to the server, but that's an implementation detail. You could use any "name" for that. For example, if you want to query for data in your table, you can write something like the code below:
var result = await table
    .Where(x => x.Column1 == "value" && x.Column2.IndexOf("foo") < 0)
    .ToListAsync();

What you'll end up is a list of items from your table (stored in the service) whose properties satisfy the expression passed to the Where method.
Another thing to notice: there are two ways of reading from an instance of the IMobileServiceTable<T> interface: using the ToListAsync (or ToEnumerableAsync) and ToCollectionAsync. The former gives you data which you can enumerate and consume directly; the latter gives you a collection which you can set as the ItemsSource property of a control, such as a ListView.

