EF 4.2 Code First, using an existing database?

Just trying to figure out if this has been solved or not.

I have a database (already created) and i want to let EF CF create the tables that are missing based on the models, is that possible?

I can't delete the database/create a new database for this, i just want it to maintain the tables based on the models).

Something like DropTablesIfModelChanges or similar.

Answers


You can do this using EntityFramework.SqlMigrations

It is avaliable using NuGet

Scott Hanselman wrote a nice blog post about that. Entity Framework Code First Migrations

hope this helps


Need Your Help

Parsing command line arguments in a unicode C++ application

c++ command-line unicode

How can i parse integers passed to an application as command line arguments if the app is unicode?

C# Picturebox leaves a white trail when moved

c# winforms

I'm using a timer to move a PictureBox inside a form. The picturebox leaves a white trail behind it which disappears when the picturebox stops. Is there any way to get rid of the white trail? I've ...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.