[ This document was written for WCF Services Version 1 Service Pack 2 and might not be up to date Please see Release Notes or Changelog for a list of changes since WCF RIA Services ]
Using Open Ria Services, you can create a Silverlight client that is aware of the application logic on the middle tier when interacting with data. You can provide a user interface for viewing and editing data that applies validation rules before submitting the data modifications. Your Silverlight controls will utilize classes that are automatically generated from code in the middle tier. This topic introduces how Silverlight clients use domain context, work with data, and customize generated code.
A DomainContext class is generated for each domain service in the middle-tier project that exposes an entity object. The domain context class contains query and modification methods that communicate with the corresponding domain operation on the domain service. When you call a query method on a domain context class in your Silverlight application, the query method calls the corresponding method on the domain service that returns the requested data. The methods on the domain context are executed asynchronously so the user interface is not blocked while loading data.
You use Silverlight controls, such as the DataGrid control, to present the data retrieved through the domain context. You bind the control to the results of the query. For more information, see Walkthrough: Retrieving and Displaying Data From a Domain Service
You can update, insert, and delete data through Silverlight controls when those operations are exposed on the domain service. When you call data modification operations on a domain service, the data from the Silverlight client is processed by middle-tier logic to ensure the business rules are applied to the modification. For more information, see Walkthrough: Editing Data From a Domain Service.
You can also use the DomainDataSource control to interact with the data from a domain service. The DomainDataSource enables you to use declarative syntax to specify paging, sorting, grouping, and filtering of the data. For more information, see DomainDataSource.
To customize the generated code, you should not modify the files in the Generated_Code folder because these files will be overwritten when the client project is rebuilt. Instead, Open Ria Services enables you to customize the code that is generated for the client project by providing partial methods on the domain context and entity proxy classes. You implement these partial methods to add computed properties on the client project or to add customized logic that is executed when particular actions are performed. The generated partial methods are invoked at run time only if you have implemented the partial method.