This sample demonstrates a WPF (Windows Presentaion Foundation) Application communicating with the WCF service exposed by a DomainService. The application does an AddServiceReference to the WCF DomainService to get a ServiceReferenceClient. It then queries the service for data, as well as makes updates to the data model.

The sample also shows has a Silverlight head working against the same Domain Service.


Geting started

For a step by step guide on how to build the HRApplication click here -

To run the application, just copy the AdventureWorks database to the App_Data Folder.
You can download the Database from here -

NOTE - If the DataBase is not present the WPF application will fail with the error:
System.Windows.Markup.XamlParseException was unhandled
'The invocation of the constructor on type 'WpfHRApp.MainWindow' that matches the specified binding constraints threw an exception.

More info

The WPF application in the sample has a ServiceReference to the WCF Service exposed by the RIA Services Domain Service @ http://localhost:XXXXX/HRApp-Web-OrganizationService.svc

The Application then queries form Employee Data from the WCF service and displays it in a DataGrid. The Application also provides a button which allows users to 'File a Sick Day' i.e. subtract 12 hours from the selcted users SickLeaveHours.

In the OrganizationService.metadata.cs file there is a Rule defined that SickLeavehours cannot be less than 12 or greater than 200.
public short SickLeaveHours;

Hence if the SickLeaveHours are reduced below 12, a validation exception is thrown.


WCF RIA Services

Microsoft WCF RIA Services simplifies the traditional n-tier application pattern by bringing together the ASP.NET and Silverlight platforms using WCF. The RIA Services provides a prescriptive pattern to write application logic that runs on the mid-tier and controls access to data for queries, changes and custom operations. It also provides end-to-end support for common tasks such as data validation, authentication and roles by integrating with Silverlight components on the client and ASP.NET on the mid-tier. It includes rich tooling for integrating client and mid-tier projects and for building rich UI through the simplicity of drag-drop support. 


For the latest information please click here .


RIA Services Home Page with links to the download site, MSDN docs, talks ... can be found here.


For help porting applications to the latest bits - Breaking Changes from Beta(PDC 09) to RTW


The document above also insludes guidance on updating VS 2008/.NET 3.5 RIA Services applications to VS 2010/.NET 4

Please use the forums to provide feedback or post questions.


Sample download instructions

Please note that once you have downloaded a from below to your machine, you need to right click on the .zip, go to the Property Page and explicitly UnBlock the content. Only then should you extract the .zip file.