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

QDSCV Load Size

10 Answers 146 Views
DomainDataSource
This is a migrated thread and some comments may be shown as answers.
poet_byron
Top achievements
Rank 1
poet_byron asked on 25 Mar 2011, 02:40 PM
Is there a way to change the Load Size of the QDSCV?  I've set the page size, but it still seems to be going out, getting all items, and throwing an error.  This is an extremely large dataset ~400,000 records, and will grow exponentially.  Thanks.

10 Answers, 1 is accepted

Sort by
0
poet_byron
Top achievements
Rank 1
answered on 25 Mar 2011, 03:51 PM
This had something to do with my RIA Services.  Sorry
0
Accepted
Rossen Hristov
Telerik team
answered on 25 Mar 2011, 03:56 PM
Hello poet_byron,

RadDomainDataSource supports paging with the help of the PageSize property. You can easily throw a RadDataPager in and it will start paging it automatically.

It does not have a LoadSize property.

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

·         Introducing RadDomainDataSource for Silverlight

·         Loading data with RadDomainDataSource for Silverlight

·         An MVVM Approach to Telerik Domain Services for Silverlight

·         Creating CRUD application with RadDomainDataSource for Silverlight

·         Why we have built RadDomainDataSource for Silverlight?

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

I hope this helps.

Regards,
Ross
the Telerik team
0
Sébastien
Top achievements
Rank 1
answered on 28 Mar 2011, 09:33 PM
Hello Ross,

I recently modified my Ria DomainDataSource for a RadDomainDataSource because my RadGridView was not sorting correctly.

Since I modified my DomainDataSource I am experiencing an issue with the RadDomainDataSource and RadDataPager, as soon as I am setting a value for the PageSize property my RadDataGridView will show only the number of row as my PageSize and my e.TotalEntityCount returns -1.

Is this a known issue?

Can you assist?

0
Rossen Hristov
Telerik team
answered on 29 Mar 2011, 09:51 AM
Hi Sébastien,

Several other customers complained that their e.TotalEntityCount became -1 when they upgraded to the official version of WCF RIA Services SP1. Is this your case as well?

Also, is there an Error returned by the server?

The thing is that RadDataPager needs to know this number (TotalEntityCount) in order to calculate the page count. Otherwise it cannot do the math.

It would be perfect if you can send us a sample project that actually reproduces this, since no one has managed to do so yet.

Regards,
Ross
the Telerik team
0
Rossen Hristov
Telerik team
answered on 29 Mar 2011, 04:25 PM
Hello,

I have some news thanks to Sébastien, who sent a project that reproduces this weird behavior.

I have found a solution for those of you who get a TotalEntityCount of -1 for one reason or another. As you know, when the TotalEntityCount coming back to the client is -1, the paging calculations cannot be done correctly because the total amount of items needs to be known.

After some searching, I finally found this blog post. Many thanks to his author.

I tried to test it on Sébastien's sample project and... it worked. Here is what I added and the TotalEntityCount miraculously started coming back to the client, thus enabling correct paging:

public IQueryable<BatisseHistoriquePoids> ObtenirBatisseInvHistoPoids(out int totalCount)
{
    List<BatisseHistoriquePoids> retour = new List<BatisseHistoriquePoids>();
    BatisseHistoriquePoids a1 = new BatisseHistoriquePoids();
 
    a1.DateSortie = DateTime.Now;
    a1.CedReelleRowid_ = new byte[] { 1, 2, 3, 3, 44, 4, 3, 2, 3, 2, 3, 2, 3, 2, 3, 3, 2 };
 
    retour.Add(a1);
 
    BatisseHistoriquePoids a2 = new BatisseHistoriquePoids();
 
    a2.DateSortie = DateTime.Now.AddDays(1);
    a2.CedReelleRowid_ = new byte[] { 5, 2, 33, 3, 44, 4, 3, 2, 3, 2, 3, 2, 3, 2, 3, 3, 2 };
 
    retour.Add(a2);
 
    BatisseHistoriquePoids a3 = new BatisseHistoriquePoids();
 
    a3.DateSortie = DateTime.Now.AddDays(2);
    a3.CedReelleRowid_ = new byte[] { 8, 2, 33, 3, 44, 4, 3, 2, 3, 2, 3, 2, 3, 2, 3, 3, 2 };
 
    retour.Add(a3);
 
    totalCount = 3;
    return retour.AsQueryable().OrderBy(tt => tt.DateSortie);

Here is what I found in the DomainOperationEntry class:

internal object Invoke(DomainService domainService, object[] parameters, out int totalCount)
{
    if (this.HasOutCountParameter)
    {
        object[] array = new object[parameters.Length + 1];
        parameters.CopyTo(array, 0);
        array[parameters.Length] = 0;
        object obj2 = this.Invoke(domainService, array);
        totalCount = (int) array[parameters.Length];
        return obj2;
    }
    totalCount = -1;
    return this.Invoke(domainService, parameters);
}

So, everything is clear.

In case your server-side method is "normal", i.e. you get the Customers from Northwind, then you should not need to add this out parameter. But if you are getting a TotalEntityCount of -1 on the client, you can use this approach.

Let me know if you find anything else regarding this topic. It turned out to be very interesting.

Has anyone noticed whether MS changed the TotalEntityCount behavior between the SP1 Beta and the official SP1 of WCF RIA Services? Does anyone know?

Regards,
Ross
the Telerik team
0
Sébastien
Top achievements
Rank 1
answered on 30 Mar 2011, 02:39 PM

Hello Ross and thanks for your help.

It did take care of our issue but this is clearly a workaround that need to be fixed in the next release.

We found out that the RadDomainDataSource is not working as the RiaDomainDataSource does. When we changed for the RadDomainDataSource the chain of event changed and we now try to load some data too early and the parameter is not set as it used to be with the RiaDomainDataSource.

I'll try to figure this one out but will contact you if needed.

Thanks and regards

0
Rossen Hristov
Telerik team
answered on 31 Mar 2011, 08:35 AM
Hello Sébastien,

Can you try to remove AutoLoad=true from XAML and do it in the PageLoaded event handler? This should trigger the first ever trip to the server after all parameters have been initialized on the client.

As for the other issue -- it is not exactly a workaround. We simply need the TotalItemCount to be known so we can do the math. If you notice, the MS DataPager will not show the total number of pages when it is on page one. It does not know them either. It simply plays it clever and hide the visual element that is supposed to show the total number of pages.

By the way, please take a look at this forum post for a more proper implementation of the count logic than the out int parameter. Basically, you can override Count method of the DomainService.

I hope this helps.

Best wishes,
Ross
the Telerik team
0
Naresh
Top achievements
Rank 1
answered on 13 Apr 2011, 06:06 PM
Hello,

Thank you for posting this workaround. We now have a TotalEntityCount and the RadDataPager is working.

However, now we have a new issue. When the user adds a filter to the grid (RadGridview bound to QueryableDomainServiceCollectionView on VM), the TotalEntityCount is always equal to the total amount of entities, not the number of filtered entities. This obviously causes the RadDataPager to show an incorrect number of pages. If the user tries to navigate to page 3 when there are really only two pages of results, an error occurs. Same error occurs if the applied filter results in zero records.

Any ideas on how to get an accurate TotalEntityCount?

Thank you,
Brian
0
Nedyalko Nikolov
Telerik team
answered on 18 Apr 2011, 11:42 AM
Hello Brian,

Indeed the problem comes from the fact that TotalItemCount is not correct.
I'll try to clarify a little bit. When you place a filter via RadGridView filter UI, this triggers two actions "filter" on the client side and due to that also "filter (load)" (with AutoLoad = true) on the server side (which in fact is the query method on the server), so this query method should respect the applied filter and should return correct TotalItemCount.
I hope this makes sense.

Kind regards,
Nedyalko Nikolov
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
Naresh
Top achievements
Rank 1
answered on 08 Jul 2011, 03:23 PM
Thanks to a post on another forum, I finally found the answer to the TotalEntityCount problem. One of our projects had a reference to the V1 version of System.ServiceModel.DomainServices.Client.dll instead of the V1 SP1 version. After correcting the reference TotalEntityCount contains the correct entity count even when a filter is applied. This problem as bugged me for months. Can't believe the solution was this simple!

Brian
Tags
DomainDataSource
Asked by
poet_byron
Top achievements
Rank 1
Answers by
poet_byron
Top achievements
Rank 1
Rossen Hristov
Telerik team
Sébastien
Top achievements
Rank 1
Naresh
Top achievements
Rank 1
Nedyalko Nikolov
Telerik team
Share this question
or