MVVM-Friendly DomainDataSource: DomainCollectionView

Yes, that’s right… we now have a component that is a big step toward addressing the request for an MVVM-Friendly DomainDataSource.  As of this posting, that feature was the #2 requested item on the RIA Services wish list, and we’ve been pondering its design for a long time.  Kyle McClellan has delivered on this and he is posting details to his blog.  This feature is completely separate from the DomainDataSource, and it’s built from the ground up with ViewModel usage in mind.

Here are some specific links from Kyle’s blog:

Here are the links you need to get up and running:

    Install WCF RIA Services SP1 for Silverlight 4

WCF RIA Services Essentials at codeplex

The RIA Services Essentials project contains sample applications/extensions demonstrating using and extending WCF RIA Services v1.

  • Book Club – It was written to demonstrate some aspects of writing a semi-real-worldish application (note that it is still very much a demo app), but more importantly, demonstrating how you can use RIA Services effectively by going beyond the basics.
  • Here is a list of what the application demonstrates:

  • Entity framework data model with one-to-many and many-to-many relationships as well as use of stored procedures
  • Local data model augmented/mixed with a web service-based data model (in this case Amazon).
  • CRUD and more (queries, insert, update, delete, as well as named update methods, and invoke methods)
  • Use of convention and configuration for identifying CRUD operations
  • Validation (field level, entity level, operation level, change-set scoped, server-only validation, async validation)
  • Custom authentication (i.e. using your DAL/user table, rather than membership)
  • Authorization (including custom authorization rules)
  • Using authentication service and your User object in server code
  • Usage of DomainServiceFactory
  • Exposing reference data
  • Presentation model for defining custom (non-DAL) types for use between client and server
  • Shared code between client and server for validation rules
  • Query limits, and caching
  • Using RIA Services with MVVM on the client
  • Adding computed properties on Entities on the client along with propagation of change notifications
  • "More" style paging (as seen for example on
  • Display of pending changes, validation errors
  • Reference data used to fill lookup dropdown lists.
  • RIA Services – Enterprise Patterns with WCF RIA Services


    A common question in the RIA Services forums is how RIA Services fit into best practices architecture. I was always impressed with the basic forms-over-data capabilities of RIA Services, but I definitely saw the opportunity to better architect my application so the framework concerns didn’t leak into the logic of my application.

    Fore more -> RIA Services – Enterprise Patterns with WCF RIA Services

    Using WCF RIA Services to include multi table master-detail data


    When you see demonstrations of technologies most of the time the data samples show single table solutions.  When was the last time you’ve developed a single-table system? :-)  Thought so.

    Chinook Entity Model

    In RIA Services demonstrations, most of them have been single-table samples as well.  So how do you go about retrieving relational data (master/details type) with RIA Services?  Here’s an option. Modify the Visual Studio generated MetaData class to add an [include] attribute on top of your chosen EntityCollection<T> and then add a method to our Domain Service class to get the additonal data. e.g.

    public EntityCollection<Album> Albums;

    public IQueryable<Artist> GetArtistsWithAlbums()
       return this.ObjectContext.Artists.Include("Albums");

    Via RIA Services and relational data

    A better way to do Silverlight 3 Sorting & Paging using DomainDataSource & DataPager


    Silverlight 3 includes PagedCollectionView class, which provides UI-level grouping, sorting and paging functionality for any data source that implements the IEnumerable interface. This works as long as all the data that you need to sort, page are already fetched to the client which could be a slow process and can potentially consumed lots of memory on the client-side. A better solution is to provide Server-side sorting & paging. 

    One way to achieve this is to use .net RIA services’ DomainDataSource and DataPager controls which provides automatic server sorting and paging support. For more details check this out: 

    Creating applications with .NET RIA Services Part 4 – Adding a DomainDataSource

    However, if you are not using .net RIA services, than you will need to implement ICollectionView to handle sorting and IPagedCollectionView to handle paging yourself –> Silverlight 3 Custom Sorting with Paging Support – Manish Dalal’s blog

    A 26-part series of Business Apps Example for Silverlight 3 & .NET RIA Services July Update

    By Brad Abrams, this demo requires:

    1. VS2008 SP1 (Which includes Sql Express 2008)
    2. Silverlight 3 RTM
    3. .NET RIA Services July ’09 Preview

    download the full demo files and check out the running application.

    Also check out the author’s Mix09 talk “building business applications with Silverlight 3”.

    Part 1: Navigation Basics

    Part 2: Rich Data Query

    Part 3: Authentication

    Part 4: SEO, Export to Excel and Out of Browser

    Part 5: Astoria, Add Service Reference and WinForms

    Part 6: Data Transfer Objects (DTOs)

    Part 7: ADO.NET Data Services Based Data Store

    Part 8: WCF Based Data Source

    Part 9: POCO and Authentication Provider

    Part 10: LinqToSql

    Part 11: The Client-Only World

    Part 12: DataSet

    Part 13: The New Class Library Project

    Part 14: Visual Basic (VB) and WPF Support

    Part 15: ASP.NET MVC

    Part 16: Exposing a WCF Service

    Part 17: Evolving an Application

    Part 18: Custom Linq Provider

    Part 19: ASP.NET Dynamic Data

    Part 20: NHibernate

    Part 21: Hierarchical Data

    Part 22: Separate Solution Files

    Part 23: Azure

    Part 24: Stored Procedures

    Part 25: ViewModel

    Part 26: Authentication and Personalization

    Via Brad Abrams : Index for Business Apps Example for Silverlight 3 RTM and .NET RIA Services July Update