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?

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

That should do it, I can select this in the WCF configuration screen. Thanks for that.
1

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

This describes, and provides tools for those scenarios

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.