我无法从 Silverlight 业务应用程序中的代码隐藏中的查询获取结果
关于您的书“Pro Business Applications with Silverlight 4”,有一些事情让我感到麻烦。我正在谈论从后面的代码中的查询获取结果。假设您正在使用 WCF RIA 服务,由于服务器和客户端之间的异步机制,您总是得不到任何结果。 我尝试使用像这样的BusyIndicator(VB),但它不起作用:
dim ctx as new DomainService1
dim query= from p As Entity1 In Ctx.GetQueryEntity1Query select p
If ctx.IsLoading = True Then
BusyIndicator1.IsBusy = True
Else
BusyIndicator1.IsBusy = False
End If
如何停止程序直到服务器完成加载操作?
regarding your book "Pro Business Applications with Silverlight 4" there is something that makes me cumbersome. I'm Talking about getting results from a query in code behind. Suppossing you are using WCF RIA Services, you are always getting Nothing as a result due to asynchronous mecanism between Server and Client.
I've tried to use a BusyIndicator like this (VB), but it doesn't work:
dim ctx as new DomainService1
dim query= from p As Entity1 In Ctx.GetQueryEntity1Query select p
If ctx.IsLoading = True Then
BusyIndicator1.IsBusy = True
Else
BusyIndicator1.IsBusy = False
End If
How to stop the Program until the Server has completed the Load Operation?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要使用 Load-DomainContext 类的方法。此方法需要调用一个查询并指定要加载的实体。
Load-Method 返回 LoadOperation,您可以使用它来检查实体的加载是否已完成并访问加载的实体。
尝试按如下方式更新您的代码:
You need to load the entities using the Load-Method of the DomainContext class. This method expects a query to invoke and that specifies what entities to load.
The Load-Method returnes an instance of LoadOperation that you can use to check if the load of the entities has finshed and to access the loaded entities.
Try to update your code as following: