Question

We are using Entity Framework 4.3 Code First. We have three databases. For each database we have one DbContext. In the first database we have some legacy tables/sql. Overall there are approx. 70-80 tables/entities.

In future we want use EF 4.3 Migration.

  • Can we merge all three database to one and keep our three DbContext classes?
  • Is it better to also merge the DbContext classes?
  • Can EF 4.3 handle this?
Was it helpful?

Solution

If you want to use 3 context types you should still use 3 databases. Database migrations are dependent on context type and migration for three context types will not work on single database (or it will cause a lot of trouble including complete manual handling of migration code). As alternative you can merge all your databases to single database you must also merge are context type to single one. The choice is up to you.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top