views:

52

answers:

2

If I have a customers and orders relationship in my Linq or EF model, at the WCF service layer I can add an order to the customer by calling

 Customer.Orders.Add(customer);

When I access my customer object on the client, and want to add an order, there is no Add method, and the Orders propery is an array. Is there any way I can work with my client side object, they same way as I do on the server?

A: 

You are not supposed to be doing that, as the objects on the client have only a semantic similarity to the service's objects - they are not the same types.

This is done to conform to one of the important tenets of service-orientation: Services share schema and contract, but not class.

However, when you generate the client-side proxy, there are options where you can choose to have collections represented by List<T> instead of arrays.

Mark Seemann
That should do it, I can select this in the WCF configuration screen. Thanks for that.
Vault
A: 

Maybe you should look into What is .NET RIA Services?, .NET RIA Services.

This describes, and provides tools for those scenarios

Sander Rijken