none
Managing Test vs. Production Schemas with EntityFramework Database First RRS feed

  • Question

  • We have two databases, Test and Production. The majority of the time the schemas are identical.  Our EntityFramework project is mapped to Test (Database First).  We simply change the connection string in the constructor at run-time to point to either Test or Production and everything works great.

    However, when we decided to add columns/properties to the Test schema for preliminary development and update the EntityFramework schema it will then fail to work with our Production database because it doesn't have those new columns yet.  Is there a way to instruct/setup EntityFramework to ignore certain columns/properties if they don't exist in the actual database?

    We typically never delete old columns or tables, only add new ones.

    Thanks

    Monday, August 10, 2015 3:14 PM

Answers

  • However, when we decided to add columns/properties to the Test schema for preliminary development and update the EntityFramework schema it will then fail to work with our Production database because it doesn't have those new columns yet.  Is there a way to instruct/setup EntityFramework to ignore certain columns/properties if they don't exist in the actual database?

    That would be a no. The database schemas without EF being in play must match, because otherwise, any C#,  VB or T-SQL code  that uses the schema on test  is going to blow up when code is deployed to production and the two schemas are not in sync.

    Monday, August 10, 2015 5:43 PM