I recently started to get into EntityFramework in order to map my model automatically into a MySql database. So I read some tutorials and started tests to validate them. Everything works fine, as far as I only have one project. If I separate the solution some problems arise. In order to demonstrate this, I set up a console project (lets call it A)with EF6.1 that saves all my data to the database. Everything works fine. If I now create a second console project (lets call it B) and and use the DbContext through a IRepository-Wrapper (from A) some problems occur:
- First of all, I have to put my config data for the database and EF config into the App.config of project B. I don't like this, but I can live with this.
- Furthermore the application compiles, but throws a exception, as long as I don't reference EntityFramework.SqlServer in project B.
In order to separate the concerns I don't want project B be to know that the data is stored via EF in a database. Or to give a real world example I don't want that my WPF Gui knows, that the data came from a database.
Is there a workaround for these problems? Did I miss something, or do I have to live with that problem when using EF?