views:

19

answers:

1

I have come to a cross roads and can't figure out the proper way to get lots of data for a form onto a Silverlight / WCF RIA Services application. Imagine an order form that you can update fields about the order (Billing information, etc.) and also other information that is read-only, payments to the order, order items, etc.

The database is roughly Orders have Order Items and Order Payments. Order Payments have Payment Methods. There is a lot of other data associated with the orders table, but this gives you an idea.

With EF4, I can do Include statements to include child properties of the Order object, like OrderPayments and OrderItems, and get them all in one shot. But I haven't found a way to get child properties that point to objects (OrderPayments->PaymentMethod).

So would it be better to have lots of queries (declared explicitly in the XAML) calling each section of data individually (using domain data contexts), or is it better to build one massive view object that gets populated and sent to the client in one shot?

A: 

The biggest advantage of RIA services with EF4 is that the queries are lazily executed on the server. e.g. If you use paging on long lists of data only the page-size chunks are transferred. That is definitely the way to go. Not massive views with multiple sets of data.

When you need specific items, not covered by the automated relational links, add query methods to RIA and call those explicitly on your domain context.

The more I use RIA the more I like it. You just have to play nice with it :)

Enough already