Change Schema of Entity Framework
I'm using Entity Framework 5 on ASP MVC 4 web site I'm developing. Because I am using shared hosting which charge for the number of databases I use I would like to run a test site near my production site.
I have two problems:
1) I use Code First and Database Migration. The migration classes seem to embed the schema dbo inside the name of the tables.
How can I change the schema according to the test/production flag
2) How can I change the schema from which EF select data?
Thank you, Ido.
Both migration and EF take schema from mapping so if you want to change the schema you must update your mapping to use:
and control the value of MySchema from configuration but this is really bad idea. One day you forget to change the value and break your production. Use local database for development and test.