Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

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/

share|improve this answer
    
Have you tried the ssdt, able to compare the 2? –  James Jun 5 '13 at 16:05
1  
Yes, I use it regularly in previous version of SSDT. I looked the newest at these links: msdn.microsoft.com/en-us/jj650015, sqlblog.com/blogs/jamie_thomson/archive/2013/03/21/…, develop.com/sqlservertwelvedatatools, blogs.msdn.com/b/ssdt/archive/2012/12/13/…. I have not tried the database unit test, but I think the key is to be used next to each other the codefirst and the SSDT. –  Gábor Plesz Jun 6 '13 at 8:30
    
I will read those blogs soon. I didn't think code-first and SSDT would work side by side. Unless you mean using code-first during dev and switching to SSDT for production? I will read your links! –  James Jun 6 '13 at 9:12
    
I'm doing database development code first method. The codefirst migration solves the steps to install the database (creating a new table, a new column to an existing table, etc). For example, if you want to create database unit tests, you can also use the SSDT. If we want to compare two structures, also can use the SSDT. At least, so I use it. Development and deployment of codefirst very good. –  Gábor Plesz Jun 6 '13 at 11:01
    
From what I seem SSDT is perfect for Db First and from everything you said and posted it seems the migrations options added to MVC4 do in fact make code-first usable beyond initial dev! –  James Jun 6 '13 at 11:20
show 3 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.