LoadedData 累积结果与 Ria 服务中的相关对象

发布于 2024-08-20 10:59:46 字数 1152 浏览 3 评论 0原文

我正在使用 SL4 & .Net Ria 服务。我的数据模型有一个名为 DeviceAndStates 的 0..* 属性的设备,通过这个 我获取了所有设备及其特定类型的 DevicesAndStates。

<riaControls:DomainDataSource Name="deviceDomainDataSource" QueryName="getDevicesWithOpenStateQuery" .../>

在客户端,两个嵌套列表框显示设备及其 DevicesAndStates。

 <ListBox ItemsSource="{Binding ElementName=deviceDomainDataSource, Path=Data}">
      <ListBox x:Name="SubRowListBox" ItemsSource="{Binding DevicesAndStates}">
      </ListBox>
 </ListBox

问题是,在服务器端,查询返回具有特定类型(仅特定类型)的 DeviceAndStates 的所有设备,但在客户端则不会。在客户端的

 private void deviceDomainDataSource_LoadedData(object sender, LoadedDataEventArgs e)
    {

        if (e.HasError)
        {
            System.Windows.MessageBox.Show(e.Error.ToString(), "Load Error", System.Windows.MessageBoxButton.OK);
            e.MarkErrorAsHandled();
        }
        else
        {

        }
    }

e.Entities 中,我得到的所有设备都是正确的,但查看他的 DeviceAndState 属性,它包含所有 devicesAndStates (查询的特定类型以及我在先前查询中获得的所有先前类型)。因此,设备的 DeviceAndState 的列表框会将查询结果累积到下一个查询。

I'm working with SL4 & .Net Ria Services. My datamodel has Devices with a 0..* property called DeviceAndStates, through this <riacontrol/> I get all Devices and his DevicesAndStates of a particular type.

<riaControls:DomainDataSource Name="deviceDomainDataSource" QueryName="getDevicesWithOpenStateQuery" .../>

In the client side two nested listboxes showing Devices and its DevicesAndStates.

 <ListBox ItemsSource="{Binding ElementName=deviceDomainDataSource, Path=Data}">
      <ListBox x:Name="SubRowListBox" ItemsSource="{Binding DevicesAndStates}">
      </ListBox>
 </ListBox

The problem is that in the server side, the query returns all Devices with its DeviceAndStates of the particular type (only of the particular type) but in the client side don't. Here in the client side

 private void deviceDomainDataSource_LoadedData(object sender, LoadedDataEventArgs e)
    {

        if (e.HasError)
        {
            System.Windows.MessageBox.Show(e.Error.ToString(), "Load Error", System.Windows.MessageBoxButton.OK);
            e.MarkErrorAsHandled();
        }
        else
        {

        }
    }

In e.Entities I get all Devices correct but looking at his DeviceAndState property, it contains all the devicesAndStates (of the particular type of the query and all the previous type I had obtained in previous queries). So the Listbox of the DeviceAndState of a Device accumulates result from a query to the next one.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

帥小哥 2024-08-27 10:59:46

您可以通过LoadOperation的AllEntities成员获取新加载的引用实体。使用一些 LINQ,您可以将其过滤为仅与相关顶级设备相关的实体。

You can get the newly loaded referenced entities through the AllEntities member of the LoadOperation. Using some LINQ you can filter this down to only the entities related to the top-level Device in question.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文