Using RIA Services Programmatically
Many demos of WCF RIA Services show off using the DomainDataSource Class to in a declarative manner to quickly throw together a data-enabled application. And in VS2010, there is added support for using the Data Sources Window to Drag/Drop data entities onto the designer — this action also adds a DomainDataSource instance into your XAML. For many applications, using a DomainDataSource in XAML is fine and enables RAD development. But some pundits (Hi Shawn!) argue that having direct interaction with the Data Layer from the UI Layer is bad for proper Model/View separation, testability, and general karma. Luckily, there are several ways to use WCF RIA Services programmatically - without relying on the DomainDataSource controls in XAML. Let’s take a look at some of these programmatic methods: Download the Demo Code * requires SL4/VS2010 Beta 2 , WCF RIA Services Beta Using the DomainContext The DomainContext class allows the Silverlight client to access the Domain Service Class you created on the server side. A new DomainContext class is automatically generated on the client side for you when you create a new Domain Service. In the demo , our DomainContext class is named BeerContext
Excerpt from:
Using RIA Services Programmatically
