Answered by:
WCF Data Services

Question
-
Does WCF Data Services have anything similar to the DomainDataSource used in RIA Services? I'm looking for something that can be used as a source for the DataGrid/DataPager controls but do paging/sorting/filtering server side using a data service.
Friday, July 16, 2010 3:58 PM
Answers
-
Hi Angiel,
The Datagrid/DataPager sorting/Paging support in Silverlight is based on the ICollectionView, IEditableCollectionView and IPagedCollectionView interfaces. To get support for server-side paging/sorting in Silverlight for WCF Data Services you would need to implement the above interfaces and then hookup the appropriate API calls to Server-side queries.
I've been toying with an implementation of the above for some of my applications and haven't had any time to properly test/document it . The Silverlight OData Explorer hosted at http://silverlight.net/ODataExplorer uses this library to provide Sorting/Paging support for the datagrid.If you want to be a test subject for this library, please send me an email at
PhaniRaj(Remove)@(Remove)Microsoft.com
Monday, July 19, 2010 12:25 PM
All replies
-
I need to bring out this point wcf ria really is geared toward wcf ria entity framework if you need to use any custom data it has to be geared as same datamodel even if you are using mvvm
If you are planning to use a custom data source wcf data service is more flexable, however you will have to use more tweeks to use it with silverlight...POCO or t4 templates(custom) are the most flexable and they use old fashioned oop repository pattern
here are the patterns you can use in wcf data services http://msdn.microsoft.com/en-us/library/dd672591.aspx
http://msdn.microsoft.com/en-us/library/ee256141.aspx poco validation
if you use entity framework you can set entity rules http://msdn.microsoft.com/en-us/library/cc668788.aspx
Friday, July 16, 2010 4:20 PM -
@billsm - Sorry if my initial post wasn't clear, but I'm looking for something that my Silverlight DataGrids can bind to that will connect to a WCF Data Service and handle paging, sorting, etc. I wasn't asking about models for the actual data service itself.
I'm not using RIA Services, but I've seen that it has a DomainDataSource control that can do all this. I was hoping there would be an equivalent that would work with Data Services.
Friday, July 16, 2010 4:46 PM -
angiel I am sorry I was not as clear also I should have mentioned this below
unfortunately I do no think this is possible in wcf data services -here's some proof below
http://www.microsoftpdc.com/2009/FT55 here's a restful talk here
I have looked at domain service you have to reference from wcf ria only....
By the have been researching this..however it looks to me....
1 Wcf data services is very good if you are using a custom data poco class and using the wcf restful architecture
2 wcf ria really is geared more to silverlight using entity framework(which uses domain service you are mentioning)
you can think of wcf ria being more specialized http://stackoverflow.com/questions/984670/what-is-the-difference-between-wcf-and-the-ria-services-domain-service-class
http://forums.silverlight.net/forums/t/190435.aspx I was very disappointed that no one really commented
about using wcf data services authentication.By the way I read this in msdn magazine you have to create custom poco data classes for authentication
Friday, July 16, 2010 8:57 PM -
Thanks for replying billsm, but I don't think we're on the same page here. Those links aren't really related to my question.
Since no one else has responded, I would guess that Silverlight doesn't support this.
Monday, July 19, 2010 12:12 PM -
Hi Angiel,
The Datagrid/DataPager sorting/Paging support in Silverlight is based on the ICollectionView, IEditableCollectionView and IPagedCollectionView interfaces. To get support for server-side paging/sorting in Silverlight for WCF Data Services you would need to implement the above interfaces and then hookup the appropriate API calls to Server-side queries.
I've been toying with an implementation of the above for some of my applications and haven't had any time to properly test/document it . The Silverlight OData Explorer hosted at http://silverlight.net/ODataExplorer uses this library to provide Sorting/Paging support for the datagrid.If you want to be a test subject for this library, please send me an email at
PhaniRaj(Remove)@(Remove)Microsoft.com
Monday, July 19, 2010 12:25 PM -
Hi angiel,
WCF Data Service doesn't provide built-in classes which support sorting/filtering like WCF RIA Service, but silverlight does. Silverlight has CollectionViewSource and PagedCollectionView which supports these functionalities. Please check below document on how to use a CollectionViewSource and set the its Source to be the result returned by WCF Data Servie:
http://msdn.microsoft.com/en-us/library/ee681614%28v=VS.95%29.aspx
Monday, July 19, 2010 10:57 PM -
Thanks phanatic. I'll check out the ODataExplorer sample. It looks like creating a custom collection view is the only way to get the functionality I need.
Tuesday, July 20, 2010 10:23 AM -
Frank,
Correct me if I'm wrong, but the example you link to still loads ALL pages of query results and does paging client side. I haven't found any way to use CollectionViewSource or PagedCollectionView with a DataPager and have just the current page of results loaded.
Tuesday, July 20, 2010 10:36 AM -
Hi,
Sorry for mistake, I didn't realize it's the server side paging we're talking about.
Wednesday, July 21, 2010 2:00 AM