I have an application with 3 tables
Items, Clients, Types
Each item can be associated to one client and one type
This was originally stored using SQL Server CE and I have now pushed the data up to azure mobile services.
I am attempting to reuse this data in a new windows universal application written in c#.
In Azure I created 3 tables itemtable clienttable typetable, in itemtable I have columns for the id of the clienttable and typetable entry (item.clienttableid = clienttable.id).
The Azure mobile services backend is set to javascript, I chose this as I thought it would be more compatible across platforms than the .net backend is that true?
I want to be able to read all the items from the items table and reference the properties of the client and type table from the item (e.g. item.client.clientname)
Is there a way of defining my class so that when I request all items from azure I also get the associated type and client.
This is how I have my class so far
public class ItemTable
{
public string Id { get; set; }
[JsonProperty(PropertyName = "itemdate")]
public DateTime ItemDate { get; set; }
[JsonProperty(PropertyName = "itemamount")]
public decimal ItemAmount { get; set; }
[JsonProperty(PropertyName = "itemdescription")]
public string ItemDescription { get; set; }
[JsonProperty(PropertyName = "ItemClientID")]
public ClientTable Client { get; set; }
[JsonProperty(PropertyName = "ItemTypeID")]
public TypeTable Type { get; set; }
}
public class ClientTable
{
public string Id { get; set; }
[JsonProperty(PropertyName = "clientname")]
public string ClientName { get; set; }
}
public class TypeTable
{
public string Id { get; set; }
[JsonProperty(PropertyName = "typename")]
public string TypeName { get; set; }
}
I have seen this http://blogs.msdn.com/b/carlosfigueira/archive/2013/08/23/complex-types-and-azure-mobile-services.aspx but cannot wrap my head around how to adapt it to my situation