Click here to Skip to main content
15,888,286 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need to create a Generic WCF Database Service, being a bit lazy I do not want to create a Service for each Entity.
I need it to work with NetTCP Binding - SO RIA, and Data Services are out.

So How can I handle a Generic Data Repository in a WCF service so that I may easily perform CRUD operations.
My Repositories are generic so I use this with Entity Framework.
C#
GenRepo<PRODUCT> products = new GenRepo<PRODUCT>();
int addedID = products.Add(product);
return products.GetByID(addedID);

So how to do this with WCF Service - whereby I have several entities. I understand there is an issue with Generics in WCF -
My Data Types are shared Client and Server applications. So I can easily write the call on the client with the type in the Generic argument <mypoco>.
Posted
Updated 27-Jan-16 10:10am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900