NHibernate DAL with radDomainDataSource

3 posts, 0 answers
  1. Eric
    Eric avatar
    3 posts
    Member since:
    Aug 2012

    Posted 29 Aug 2012 Link to this post

    Hello,
    I used NHibernate as DAL which not support LINQ. I want to use radDomainDataSource as server side paging. Code as following,
    In my DomainService:

    public IEnumerable<RAF.DTO.Supplier> GetSuppliers(string supplierTypeCode, int firstResult, int maxResults, out int totalCount)
            {
                IEnumerable<RAF.DTO.Supplier> dtoSuppliers = _suppliers.GetSuppliers(ref _lastSuppliersCount,                         
    DomainEnumerations.MappingType.Grid, supplierTypeCode, firstResult, maxResults);
                totalCount = (int)_lastSuppliersCount;
                return dtoSuppliers;
            }

    In the UI Code, I modified Query.Parameters["firstResult"] in order to get correct paged data from DomainService.
            void rddsSuppliers_LoadingData(object sender, Telerik.Windows.Controls.DomainServices.LoadingDataEventArgs e)
            {
                Telerik.Windows.Controls.RadDomainDataSource dataSource = (Telerik.Windows.Controls.RadDomainDataSource)sender;
                e.Query.Parameters["firstResult"] = (dataSource.DataView.PageIndex + 1) * dataSource.DataView.PageSize;
                e.LoadBehavior = LoadBehavior.RefreshCurrent;
            }

    But the RadDomainDataSource will append Skip().Take() to my Paged Data, this cause incorrect DataView(no data).My problem is how to get the query send to server without Skip and Take(I have read the thread http://www.telerik.com/community/forums/silverlight/domain-datasource/how-to-get-the-query-sent-to-server-without-skip-and-take.aspx). I using the method "PagingRemover", but I failed to modified the e.Query.Query.Expression because it is read only!

    Any idea?
    Thanks
  2. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 29 Aug 2012 Link to this post

    Hello,

    RadDomainDataSource is a client-side component. It is not aware of any DAL's.

    WCF RIA Services are based on LINQ and the IQueryable interface. You best option would be to intervene in the data service methods on your server and change what is needed there. This is the boundary between WCF RIA Services and your DAL.

    All the best,
    Ross
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft banner
  4. Eric
    Eric avatar
    3 posts
    Member since:
    Aug 2012

    Posted 29 Aug 2012 Link to this post

    Dear Ross,
    Thank you for your reply. Yes, you are exactly right.

    But the DAL is from another vendor, it is impossible to change the API.
    So, is there any way to strip the Skip and Take from Query.Query.Expression?

    Best Regards
Back to Top