WCF Data Services consuming data from EF based repository
Posted
by John Kattenhorn
on Stack Overflow
See other posts from Stack Overflow
or by John Kattenhorn
Published on 2010-05-11T11:31:32Z
Indexed on
2010/05/11
11:34 UTC
Read the original article
Hit count: 775
We have an existing repository which is based on EF4 / POCO and is working well. We want to add a service layer using WCF Data Services and looking for some best practice advice.
So far we have developed a class which has a IQueryable property and the getter triggers the repository 'get all users' method. The problem so far have been two-fold:
1) It required us to decorate the ID field of the poco object to tell data service what field was the id. This now means that our POCO object is not 'pure'.
2) It cannot figure out the relationships between the objects (which is obvious i guess).
I've now stopped this approach and i'm thinking that maybe we should expose the OBjectContext from the repository and use more 'automatic' functionality of EF.
Has anybody got any advice or examples of using the repository pattern with WCF Data Services ?
© Stack Overflow or respective owner