Entity Framework and WCf

Posted by Nihilist on Stack Overflow See other posts from Stack Overflow or by Nihilist
Published on 2010-04-23T21:51:25Z Indexed on 2010/04/23 21:53 UTC
Read the original article Hit count: 250

Filed under:
|
|

Hi I am little confused on designing WCf services with EF.

When using WCf and EF, where do we draw this line on what properties to return and what not to with the entity.

Here is my scenario

I have User. Here are the relations.

User [1 to many] Address, User [ 1 to many] Email, User [ 1 to many] Phone

So now on the webform, on page1 I can edit user information. say I can edit few properties on the user entity and can also edit address, phone, email entities[ like add / delete and update any]

On page2, i can only update user properties and nothing related to navigation properties [ address, email, phone].

So when I return the User Entity [ OR DTO] should i be returning the navigation properties too? Or should the client make multiple calls to get navigation properites. Also, how does it go with Save? Like should the client make multiple calls to save user and related entites or just one call to save the graph?

Lets say, if I just have a Save(User user) [ where user has all the related entities too] both page1 and page2 will call save and pass me the user. but one page1 i will need a lot more information. but on page2 i just need the user primitive properties.

So my question is, where do we draw this line, how do we design theses services ? Is the WCF operation designed on the page and the fields it has ?

I am hoping i explained my problem well enough.

© Stack Overflow or respective owner

Related posts about entity

Related posts about entity-framework