Silverlight RIA Services - Showing columns from multiple tables

Posted by Villager on Stack Overflow See other posts from Stack Overflow or by Villager
Published on 2010-05-20T12:12:50Z Indexed on 2010/05/20 12:30 UTC
Read the original article Hit count: 269

Filed under:

Hello,

I have been evaluating Silverlight and .NET RIA Services for my company. I am trying to decide if it is right for us. For the most part, I like it. But, I see one item that I am surprised that I cannot do easily. Because of this, I'm guessing I'm doing some thing wrong. To demonstrate, I have two database tables:

Order
-----
ID
CustomerID
OrderDate
OrderNumber

Customer
--------
ID
FirstName
LastName
Address

When I create my Domain Service class, I select both of these tables. On the Silverlight application, I drag-and-drop the Order entity from the Data Sources page to my Silverlight page. When I do this, a DataGrid is added with all of the properties in the Order entity. In reality though, I would like the DataGrid to show:

  • Order.OrderNumber
  • Order.OrderDate
  • Customer.FirstName
  • Customer.LastName

Because this information is spread across multiple tables, I'm not sure how to use RIA Services to show them in my Silverlight application.

What is the recommended way to do this? Should I add a view in my database? Can I do it without touching the database?

Thank you,

© Stack Overflow or respective owner

Related posts about Silverlight