views:

100

answers:

1

Hello,

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.

A: 

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.

Jeff Handley