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

NHibernate DAL with radDomainDataSource

2 Answers 75 Views
DomainDataSource
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Eric
Top achievements
Rank 1
Eric asked on 29 Aug 2012, 08:14 AM
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 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 29 Aug 2012, 08:21 AM
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.

0
Eric
Top achievements
Rank 1
answered on 29 Aug 2012, 08:32 AM
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
Tags
DomainDataSource
Asked by
Eric
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Eric
Top achievements
Rank 1
Share this question
or