Click here to Skip to main content
15,896,154 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

How can i implement a service layer in my MVC application using Entity framework and WCF. The idea is to abstract database detail.

Thanks
Posted

If you're using EF then that sort of abstraction is not really needed, but if you want it, then you create a DLL, do your EF mappings in there, and place all your model classes in there, too, as they will map to your DB. I think it's messy, but you can do it that way, and just provide all the code that changes the DB through EF inside that DLL.

Really, EF is doing that for you, it provides database access through strongly typed model classes and hides the DB layer from you.
 
Share this answer
 
v2
 
Share this answer
 

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