If I have this project structure
- Foo.Data
- reference EntityFramework
- Foo.Business
- reference Foo.Data
- Foo.Web
- reference Foo.Business
Isn’t that supposed to allow me to prevent adding a reference to EntityFramework from Foo.Web?
How can I call System.Data.Entity.Database.SetInitializer() from my global.asax.cs without adding the EntityFramework reference?
What you can do is create a
InitializeDatabase()function in yourFoo.Businessproject which in-turn callsSystem.Data.Entity.Database.SetInitializer(). You can then callInitializeDatabase()from yourFoo.Webproject which already has a reference toFoo.Business