Include related properties in WCF RIA Services

21 Feb

WCF RIA Services provide lots of possibilities on getting data from the server to the client whether it is a Silverlight client or a console application.

One of the challenges that you may experience using WCF RIA Services is getting related properties to an entity to be included on the client. But no need to get scared – it is actually pretty easy.

First of all you need to create an association between your entity and the related entity. Lets say we have a company (Company) with a CEO (Employee):

image

image

When we get a list of companies from the client we would like to have the CEO property included and filled on the company. To do that we need to add a few attributes to the CEO property. Instead of adding the attributes on the entity object we can create a metadata file that holds this type of information.

image 

Now the CEO property will be included, filled and ready to use when we call a query from the client that returns a list of companies.

You can download sample from my DropBox: http://dl.dropbox.com/u/4243120/SL%20Demos/RiaIncludePropertiesDemo.zip

by xamlgeek

3 Responses to “Include related properties in WCF RIA Services”

  1. Joshua May 22, 2011 at 22:56 #

    What does the “Association” attribute mean?

Trackbacks/Pingbacks

  1. Properties in WCF RIA Services – using LINQ-to-SQL « thomas martinsen - February 28, 2010

    […] in WCF RIA Services – using LINQ-to-SQL February 28, 2010 I have previously written a post about including properties in WCF RIA Services. The post was using POCO as business model. If you […]

  2. 2010 in review « xamlgeek - January 3, 2011

    […] Include related properties in WCF RIA Services February 2010 1 comment 5 […]

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 )

Google+ photo

You are commenting using your Google+ 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 )

w

Connecting to %s

%d bloggers like this: