Question

I have been given a spec to create a new MVC4 website, it will not be too large a project at first but I suspect it will grow as the business gets new ideas for it.

Using .NET 4.5 ASP.NET MVC4 and EF I have to choose between code-first with migrations or Sql Server Data Tools (SSDT) for handling my database.

With the SSDT I can control my database in a project as part of my solution and handle the changes all the way from dev through to production and beyond using dacpac files. My experience of code-first from MVC3 was not to use it beyond development due to the limited database options. It would always end up with dropping the Db on model change or handle the Db changes manually. However I am led to believe with MVC4 Migrations that is no longer the case and I can now push updates to the Db.

So my question is which one is the most efficient to use based on saving time/effort in development but also scalable and able to handle production changes. I liked code-first and the ability to generate my Database from Models, does the introduction of migrations now make it viable in production?

Was it helpful?

Solution

My personal opinion is that codefirst great tool and great for development. The steps of databasefirst development should be scripting external tools or by hand, if you already have a production database.

The codefirst to be included in the development of database version control system and provides a distributed database development.

Starting point, it's a good series:

http://coding.abel.nu/2012/02/using-entity-framework-to-create-a-database/

Licensed under: CC-BY-SA with attribution
scroll top