Question: 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.

Answer: 
Both migration and EF take schema from mapping so if you want to change the schema you must update your mapping to use:

```
modelBuilder.Entity<MyEntity>().ToTable("MyTable", "MySchema");

```

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.
As already said: use identical databases (structurally) for development, test and production.

The goal of schemas is to group database objects, like we do with namespaces in e.g. C#, or to simplify permissions for groups of database objects. Not to identify database stages. By using them for the latter you also make it much harder, if not impossible, to use schema appropriately. See for instance [this](http://msdn.microsoft.com/en-us/library/dd283095%28v=sql.100%29.aspx) MSDN white paper.

It is much easier to use some database name conventions to indicate their purpose.