2

We have a project in MVC, wherein we are done with the Phase-I development

Now for Phase2, our database changes and Model edmx file will change as per development

Also, bugs and changes will be simultaneously fixed for Phase-I

So, how can i maintain my edmx files in Production Server and Development Server

2 Answers 2

3

edmx files in Production Server and Development Server

You need to use some kind of Version control mechanisms like TFS, and with proper Branching and merging you can manage development and production versions - Read this article on TFS Branching. Alternatively you have Git and many others too.

Also you have to plan your Database version migrations between production and development versions. For that EF has Migration techniques, which you can use.

Sign up to request clarification or add additional context in comments.

Comments

1

You have a few options to consider. Firstly, and as a precursor to any other changes, do as @ramiramilu says and get your code under source control.

After this, you are faced with the issue of how to deal with database schema changes introduced as part of your changes. Here are some routes you could take:

  1. Shift over to code first development in order that you can use database migrations. I've used Entity Framework in both model first and code first modes. My experience is that the reduced hassle of the database migrations feature far outweighs any perceived benefit of having a visual model of the mapping between your code and your database. There are also tools to reverse generate a model from your code, if you need to.
  2. Keeping with your model first approach, you could look at generating SQL update scripts that provide database deltas between deployments. These would then be added to a folder with some kind of naming convention to indicate the order they should be applied (e.g. yyyymmdd-descripion.sql). One way of generating the deltas is by using the Schema Compare tool in Visual Studio. You could choose to keep the current development version of the database as a database project in your solution, though there is a danger here of inconsistency between the DB project and a database that would be generated from the model.
  3. Again sticking with the model first approach, you could generate a delta SQL script at the time of deployment using, for example, SQLPackage.exe. This has the advantage that you don't need to maintain a set of delta scripts and deal with the issues of knowing what version of the set of deltas a particular database is at. The disadvantage is that if the delta script needs some modification before running (as it might do in scenarios where there is a lot of data or some unusual schema set up) your overall deployment time becomes longer.

Overall, I'd really recommend looking at option 1, the code first development option.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.