Chapter 8. What’s Coming Next for Code First
So far, this book has covered all of the Code First components that reached their final release at the time of writing. There are, however, some notable features that are still in preview at this time that you should be aware of. You’ll gain the ability to migrate a database schema as your Code First model evolves, reverse engineer a Code First model from an existing database, and many other useful tasks.
These features are available as add-ons to the EntityFramework NuGet
package and can be downloaded separately. Currently there are two add-ons
available. The first, the EntityFramework.Migrations
NuGet package, adds database migration capabilities to Code First. The
second, Entity Framework Power Tools, provides some extra design time
tooling for working with Code First and is available on Visual Studio
Gallery.
Code First Migrations
Throughout this book we have used database initializers to drop and recreate the database every time the model changes. This is far from ideal, because in doing so, you lose any data every time the model changes. That might be acceptable while you’re developing locally, but it’s definitely not a viable solution once you want to push changes into production! Currently you are forced to use a schema compare tool or a hand-written script to push database changes to the production database.
Since Code First was released, one of the most common requests from the developer community was for a migrations solution. ...
Get Programming Entity Framework: Code First now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.