We are creating a website from scratch and the will be created in MVC 4.0 With EF4.0
And we wish to create a common data access layer using EF and expose the EF using WCF. As the EF contains the CodeLogic we wish to separate the EF from the client calls. The client has to call the WCF via POCO object and the WCF will inturn return some kind of results using POCO.
And my question is this kind of logic is ok. How can I convert POCO to EF and vice versa.
Thanks for your time and patience
First of all, I don’t know if it is a good idea to expose Entities directly from a webservice. Maybe you wanna use a Data Transfer Object and maybe you wanna use a WCF REST or a WebApi (webservice is quite outdated). That would be a good idea if you have your Business logic inside the WebService. If not, it’s quite weird to use Entify Framework capabilities and then hide all the advantages behind a webservice.
Anyway, there is a awesome tool for converting from one object to another, it’s called automapper.