In this chapter, you will learn how to make structural database changes using the Entity Framework migrations API. Previously, we used an initializer to drop and recreate the database to handle such changes. Now, you will learn how to use Entity Framework migrations to achieve the same end result without data loss. We will also discuss the process of integrating Entity Framework with an existing database, instead of allowing the framework to create a database from scratch. We will also take a look at some additional features in Entity Framework that we need to be aware of that are not commonly used on a daily basis.
In this chapter, we will cover how to:
Enable migrations on a project that uses Entity Framework
Use automatic migrations
Create explicit migrations
Add database artifacts, such as indexes
Add migrations to an existing database
Use additional Entity Framework features (not covered in previous chapters)