To correspond to the new RIA Services build we’ve released at Mix, I’ve made some updates to the DomainCollectionView. I updated select API, fixed a few bugs, and updated the sample as well. If you’re not familiar with the DCV, here’s my original post introducing it. For the sake of brevity in this post, I’ll assume you’ve read it.
There are a few breaking changes to the API. Most notably, SortPageAndCount has been renamed. It’s a breaking change, but a simple find-replace should set things right again.
There were a few bug fixes that went in to improve compatibility with third-party controls. I’ve tested the DCV against four suites of controls now, and it works well with all of them. As always, let me know when you find issues.
A common question in response to the first post was how to implement filtering. It turns out to be pretty easy, so I wanted to make it obvious with some updates to my sample.
I’ve updated the UI to include a search field.
The search button now invokes the search command which calls into the OnSearch method in my SampleViewModel.
private void OnSearch()
// This makes sure we refresh even if we're already on the first page
// This will lead us to re-query for the total count
The OnSearch method resets the total item count and refreshes the view; leading us back into our load callback.
private LoadOperation<SampleEntity> LoadSampleEntities()
this.CanLoad = false;
EntityQuery<SampleEntity> query = this._context.GetAllEntitiesQuery();
query = query.Where(e => e.String.Contains(this.SearchText));
To make sure the filter gets applied on the server, we conditionally add a Where clause to our query based on the content of the SearchText.
That covers the new additions to the DomainCollectionView. Once again we’ve put together a small sample running with server-side filtering, sorting, grouping, and paging. Here’re the sample bits. Let me know if you have any questions.