Vault
Vault

Reputation: 23

Linq, Entity Framework and WCF

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?

Upvotes: 2

Views: 267

Answers (2)

Sander Rijken
Sander Rijken

Reputation: 21615

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

This describes, and provides tools for those scenarios

Upvotes: 1

Mark Seemann
Mark Seemann

Reputation: 233150

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.

Upvotes: 1

Related Questions