It seems that the Code First DbContext really uses the given ConnectionString during compile? I don't even know how that is possible but to me it seems to be so. If I turn OFF my local SQL Server, I get the error stating "Failed to get the MetadataWorkspace for the DbContext type...". Turning the SQL Server ON, everything compiles fine.
Here's part of my context (I'm using an existing database and yes, I know, not actually code first)
public class MyContext : DbContext
{
public MyContext() : base("MY_DYNAMIC_CONNECTIONSTRING")
{
Database.SetInitializer<MyContext>(null);
}
...
If this is really the case, there's a huge problem. How can I prevent it from doing that? What if I'm using separate build machines where the ConnectionString doesn't work? Or am I doing something wrong? Any advice?