WCF RIA Service is a higher-level framework and a new component of frameworks like .NET 4 and Silverlight 4 that eases the procedure of building a complex business application in Silverlight by offering client-side validation. RIA stands for Rich Internet Applications.
What is WCF Ria Services?. The Complete Windows Communication Foundation (WCF) Developer Course 2022 [Videos].
It must be noted here that Silverlight is a framework offered by Microsoft, ideal for rich internet applications and is available for use as a browser plug-in, just like Adobe Flash.
WCF RIA Service is mainly based on the standard version of WCF service. The following figure illustrates a part of the WCF architecture, where WCF RIA services has its focus in general.
Creating a WCF RIA Service is the next step to have a better understanding of the concept. The step-by-step procedure is given below.
Step 1 − Create a new web project of the name SLWCFRiaServices.Web using Silverlight 5 and then add a new item by selecting ADO.NET Entity Data Model to the same.
Step 2 − Now choose model contents from the Entity Data Model Wizard by generating the model from the database.
Step 3 − From the same wizard, choose your data connection and database objects.
Step 4 − Build the solution so that in future, recognizing the data model will not a problem for the domain service you are going to create.
Step 5 − Now create a domain service in the web project by adding a new item and make sure to enable client access.
Step 6 − In the very next step, some classes will be generated and it is essential to build them again.
Step 7 − In this step, DataDomainContext is displayed by the Data Sources Panel.
Step 8 − In this step, the Video below the DataDomainContext should be selected and customized.
Step 9 − Attaching the DataGrid Control with the Data Source is the step committed here, along with selection of themes. Here BureauBlue theme has been selected.
Step 10 − The last and the final step comprises of going to the design screen and adding entity in the layout area of the MainPage by simple drag and drop. It is also vital to ensure AutoGenerateColumns = "True" and to run it to view the output.
There are some prerequisites for experiencing the full potential of WCF RIA services −
- Visual Studio 2010 / Visual Studio 2012
- Silverlight Developer Runtime
- Latest version of RIA Services Toolkit
- SDK (Software Development Kit)
WCF RIA Domain Service
A domain service comprises of a set of data operations related to business. It is nothing but a WCF service that exposes any WCF RIA Service applications business logic.
A WCF RIA Domain Service has the hosting class DomainServiceHost internally, which in turn uses the WCF ServiceHost class for hosting the application. To make the domain service accessible for the client project, it should have the EnableClientAccessAttribute attribute. The attribute is applied automatically whenever a new domain service class is added.
The following figure shows the architecture of a WCF RIA Domain Service −
WCF RIA Services – Querying Data
The following figure shows how a query is created on the client side and executed on the server side to return queryable results. DAL stands for Data Access Layer.
WCF RIA Services – Updating Data
The following figure shows how data is updated by executing the CUD (Create Update Delete) operation on the server side. It should be noted here that WCF RIA service is always stateless on the server side.