[WCF RIA Services Version 1 Service Pack 2 is compatible with either .NET framework 4 or .NET Framework 4.5, and with either Silverlight 4 or Silverlight 5.]
Using WCF 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.
For more information, see DomainContext and Operations.
Presenting and Modifying 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.
Customizing Generated Code
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, 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.