【发布时间】:2017-02-19 22:01:36
【问题描述】:
我有一个包含 3 个表的应用程序
Items, Clients, Types
每个项目可以关联到一个客户端和一种类型
这最初是使用 SQL Server CE 存储的,我现在已将数据推送到 Azure 移动服务。
我正在尝试在用 c# 编写的新 Windows 通用应用程序中重用这些数据。
在 Azure 中,我创建了 3 个表 itemtable clienttable typetable,在 itemtable 中,我有 clienttable 的 id 和 typetable 条目 (item.clienttableid = clienttable.id) 的列。
Azure 移动服务后端设置为 javascript,我选择这个是因为我认为它比 .net 后端更能跨平台兼容,是这样吗?
我希望能够从项目表中读取所有项目,并从项目中引用客户端和类型表的属性(例如 item.client.clientname)
有没有一种方法可以定义我的类,这样当我从 azure 请求所有项目时,我也会获得关联的类型和客户端。
这就是我目前上课的方式
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; }
}
我看过这个http://blogs.msdn.com/b/carlosfigueira/archive/2013/08/23/complex-types-and-azure-mobile-services.aspx 但无法理解如何适应我的情况
【问题讨论】:
标签: c# azure win-universal-app azure-mobile-services