This is a migrated thread and some comments may be shown as answers.

RadDomainDataSource does not detect underlying data has changed

3 Answers 94 Views
GridView
This is a migrated thread and some comments may be shown as answers.
HDC
Top achievements
Rank 1
HDC asked on 01 Jun 2011, 07:11 PM
Hi,

I have a raddomaindatasource defined in XAML

I have bound a raddatagrid with the DataView on raddomaindatasource:

    <telerik:RadGridView x:Name="InvoicesGrid" 
ItemsSource="{Binding ElementName=invoicesDomainDataSource, Path=DataView}"                                       

The query executed by domaindatasource is a simple query from an entitymodel.

var sortedinvoices = from inv in ObjectContext.InvoiceViews
                     orderby inv.DateOfInvoice descending
                     where inv.Name.Contains(search) || search == ""
                     select inv;
return sortedinvoices;

I have added a button to the xaml page

when the button is clicked, i execute a domaindatasource.Load(), Before executing this statement, i have hooked the LoadedData event and in this event i perform a grid.Rebind():

private void RefreshClick(object sender, RoutedEventArgs e)
    {      
      invoicesDomainDataSource.LoadedData += new EventHandler<Telerik.Windows.Controls.DomainServices.LoadedDataEventArgs>(invoicesDomainDataSource_LoadedData);            
      invoicesDomainDataSource.Load();            
    }
  
    void invoicesDomainDataSource_LoadedData(object sender, Telerik.Windows.Controls.DomainServices.LoadedDataEventArgs e)
    {
      this.InvoicesGrid.Rebind();
    }

On the database, i have opened the SQL Server Management studio and i change for example the date of the invoice.

When the user clicks the button, i can debug the code... I executes the query on the entityframework and i notice that the correct data is loaded at that point. But when the debugger returns on the client and in the LoadedData event, i notice that the LoadedDataEventArgs still contains the old records!!!

It looks like the RadDomainDataSource is working with Cached data... how can i tell the raddomaindatasource to use the newly fetched data instead?

Best Regards,

Peter

3 Answers, 1 is accepted

Sort by
0
HDC
Top achievements
Rank 1
answered on 02 Jun 2011, 07:06 AM
Turns out i had better posted this in the domaindatasource subforum as it has nothing to do with the grid.

For whom it is of interest, here is the solution:

http://www.telerik.com/community/forums/silverlight/domain-datasource/cannot-reload-data.aspx

HOWEVER... Can somebody please give some more explanation why this is DEFAULT behavior?

I can understand the performance gain from reusing data... but by calling a .load() operation on the domain datasource your are already wasting bandwidth AND for nothing !!  since the output is ignored by default. Shouldn't the domain datasource use refresh by default as LoadBehavior when the Load() is called upon it?

In a multiuser scenario, it is very common that multiple people will change data from the same table at the same time. I do not understand why the domain datasource does not automatically see that the incoming data is different from its own.

I find that the default behavior is very dangerous... the idea that your users keep staring at old data without even knowing it and that i'm quite sure most developers will not even notice this (i didn't see this for weeks, until i started using it in a multi user scenario)

In addition... why make it so though to change the default behavior? Why not just provide a property LoadBehavior on the raddomaindatadatasource?

I would appreciate it a lot, if someone from Telerik would be able to adress my concerns here?
0
Accepted
Rossen Hristov
Telerik team
answered on 03 Jun 2011, 08:45 AM
Hi peter,

First of all, once you have hooked the grid up to the RDDS you do not have to call any Rebind methods. It will be done automatically for you. Don't do that!

If you attach to the LoadingData event, you will get a LoadBehavior setting in the event arguments. This is done in exactly the same way with the stock DomainDataSource control, so we have decided to keep the behaviours and API's consistent between the two.

Here you can learn more about the LoadBehavior setting.

To learn more about RadDomainDataSource please read the following blog posts:

You can also learn more about the WCF RIA Services technology here.

Kind regards,
Ross
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
HDC
Top achievements
Rank 1
answered on 05 Jun 2011, 07:29 AM
Thanks for the Info Ross.

I still feel that the wrong choice was made for the default behavior of the domaindatasource, even if the choice was made by Microsoft.
But now that i know that it is that way, i can take it into account.

Best Regards,

Peter
Tags
GridView
Asked by
HDC
Top achievements
Rank 1
Answers by
HDC
Top achievements
Rank 1
Rossen Hristov
Telerik team
Share this question
or