Learn WCF RIA Service: Day 3

Learn WCF RIA Service: Day 1

Learn WCF RIA Service: Day 2

Overview of Domain Service Class

On day 2 we ran through creating our first line of business application using RIA services. We did not look deeper much into generated classes. Today we will take a step back and examine Domain Service class. Better understanding on Domain Service class would give us more efficiency to create, share and focus on application logic in between presentation layer and middle layer.

If you go ahead and open solution explorer of project we created on day 2, you will get two projects, one Silverlight and other hosting web project there.


If you remember we added Domain Service class to the web project and we enabled metadata for domain services as well. Due to that you are seeing there is a metadata.cs class in solution explorer.

Open SchoolRIAService.cs and first thing you would notice would be as in below image.


  1. Attribute EnableClientAccess tells this domain class would be visible to the presentation layer residing at client side.
  2. The class is derived from LinqToEntitiesDomainService. This is generic abstract class and it is part of WCF RIA Service framework.
  3. Generic class is taking data model class as input to create domain service.

Next you move further in the class you will find different CRUD methods for different entities from data model. If you have four entities in data model then you will have 16 methods here. For each entity there would be four methods.

Below four methods would perform CRUD operation for Course entity.


In this way you will find CRUD methods for other entities like Departments, OnlineCourses etc

If you remember at time of creating Domain Service class, we checked the check box against entities class to enable editing.


Besides different generated methods you can plug application logic in this Domain Service class. You can modify existing application logic also for example modifying logic behind GetCourse() method.

I will conclude day 3 with assumption that by now you have an overview of Domain Service Class.

See you on day 4 Smile

6 responses to “Learn WCF RIA Service: Day 3”

  1. […] Learn WCF RIA Service: Day 3 and Revised Windows Azure Portal: 2nd August 2011 (Dhananjay Kumar) […]

  2. Dhananjay,

    The information is well written and very well explained. For some reasons the images are not accessible. Please publish the images that will make it more easier for people to understand.

    Pranjal R Nigam

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a website or blog at WordPress.com