I have just developed an MVC web application with Entity Framework and Code First. This application enqueue jobs in a table.
Now I´m developing a Windows Service that reads this jobs table, and process the jobs. The perfect solution would be to use Entity Framework in this windows service.
My problem is how to implement Entity Framework in a Windows Service, and more important, how to use in the windows service (think as the client) the models of the MVC web app (think as the server).
I´ve seen that Code First is not compatible with ADO.NET Self-Tracking Entity Generator that seems the right solution for a server-client enviroment. Do I need to change the Code First EF application to STE, or are there other solutions to get the models in the windows service?
I have googled how to implement EF in a Windows Service that acts as a client, but found nothing. A how-to/tutorial would be perfect.
Thank you very much
1) Sharing the data layer:
You should separate your data layer code into a separate assembly ( project ) and reference this from both your web app and your service.
2) Self Tracking Entities:
You shouldn’t use these any more. They were useful before EF 4.1, but are now obsolete. It is fine to use your POCO objects in your service.