I have been evaluating Silverlight and .NET RIA Service开发者_运维问答s 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,
This is referencing our stuff, but the logic would be the same for how you would create a new query and custom class in your service, which is then available for calling via your domain context, binding to a grid/list, etc.:
WCF RIA Services handling multiple tables
精彩评论