如何获取引用对象的详细信息
How to get the referenced object details
我有两个模型
public class Movie : EntityData
{
public string Title { get; set; }
public string Description { get; set; }
}
和
public class Category : EntityData
{
public string Name { get; set; }
public List<Movie> Movies { get; set; }
}
使用 codefirst 迁移,它创建了两个具有外键关系的 table。它在 Movies
table.
中添加了一个列名称 MovieCategoryID
我为 Category
创建了一个 TableController
并想要检索所有类别。
public class CategoryController : TableController<Category>
{
protected override void Initialize(HttpControllerContext controllerContext)
{
base.Initialize(controllerContext);
MobileServiceContext context = new MobileServiceContext();
DomainManager = new EntityDomainManager<Video>(context, Request);
}
public IQueryable<Category> GetAllCategories()
{
return Query();
}
}
当我尝试从客户端获取如下类别时
this.client = new MobileServiceClient(Constants.ApplicationURL);
this.categoryTable = client.GetTable<Category>();
IEnumerable<Category> categories = await categoryTable.ToEnumerableAsync();
所有类别的“电影”属性 为空。告诉 Azure table 控制器获取所有相关 'Movies' 的更好方法是什么?
如果您需要任何说明,请告诉我!
Azure 移动应用不支持关系。
您可以在后端使用自动 $expand 查询。有关这方面的信息,请参阅 https://shellmonger.com/2016/05/27/30-days-of-zumo-v2-azure-mobile-apps-day-26-relationship-advice/
您可以在 http://aka.ms/zumobook - 第 3 章中阅读有关 Azure 移动应用数据故事的更多信息。
我有两个模型
public class Movie : EntityData
{
public string Title { get; set; }
public string Description { get; set; }
}
和
public class Category : EntityData
{
public string Name { get; set; }
public List<Movie> Movies { get; set; }
}
使用 codefirst 迁移,它创建了两个具有外键关系的 table。它在 Movies
table.
MovieCategoryID
我为 Category
创建了一个 TableController
并想要检索所有类别。
public class CategoryController : TableController<Category>
{
protected override void Initialize(HttpControllerContext controllerContext)
{
base.Initialize(controllerContext);
MobileServiceContext context = new MobileServiceContext();
DomainManager = new EntityDomainManager<Video>(context, Request);
}
public IQueryable<Category> GetAllCategories()
{
return Query();
}
}
当我尝试从客户端获取如下类别时
this.client = new MobileServiceClient(Constants.ApplicationURL);
this.categoryTable = client.GetTable<Category>();
IEnumerable<Category> categories = await categoryTable.ToEnumerableAsync();
所有类别的“电影”属性 为空。告诉 Azure table 控制器获取所有相关 'Movies' 的更好方法是什么?
如果您需要任何说明,请告诉我!
Azure 移动应用不支持关系。
您可以在后端使用自动 $expand 查询。有关这方面的信息,请参阅 https://shellmonger.com/2016/05/27/30-days-of-zumo-v2-azure-mobile-apps-day-26-relationship-advice/
您可以在 http://aka.ms/zumobook - 第 3 章中阅读有关 Azure 移动应用数据故事的更多信息。