如何在 WCF Ria Services/Linq2SQLDomainModel 中预先加载
我的视图中有一个数据绑定网格(XAML),并且 Itemsource 指向 ReportsCollection。报告实体具有三个原语和一些复杂类型。这三个在数据网格中按预期显示。此外,Reports 实体还有一个 Store 类型的属性。当通过 GetReports 域方法加载报告时,我很快发现只返回基元,而不返回某个深度的整个图。因此,由于我也想加载 Store 属性,因此我在域服务中进行了此更改:
public IQueryable<Report> GetReports()
{
return this.ObjectContext.Reports.Include("Store");
}
从我在立即窗口中看到的情况来看,商店已按预期加载,但当返回到客户端时仍会被修剪。如何解决这个问题?
谢谢你!
I have a databound grid at my view (XAML) and the Itemsource points to a ReportsCollection. The Reports entity has three primitives and some complex types. These three are shown as expected at datagrid. Additionally the Reports entity has a property of type Store. When loading Reports via GetReports domain method, I quickly figure out that only primitives are returned and not the whole graph of some depth. So, as I wanted to load the Store property too, I made this alteration at my domain service:
public IQueryable<Report> GetReports()
{
return this.ObjectContext.Reports.Include("Store");
}
From what I see at the immediate window, store is loaded as expected, but when returned to client is still pruned. How can this be fixed?
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 [Include] 修饰 ReportMetadata 类中的 Store 属性。
Decorate the Store property in the ReportMetadata class with [Include].