
- C#
- Intermediate
About this Course
In this course, you'll learn how to use Entity Framework Code First Migrations to propagate data model changes to your database.
What you'll learn
- Enabling Migrations
- Adding Migrations
- Updating the Database
- Modifying Migrations
- Deploying Migrations
Getting Started with Using Migrations
We'll start by looking at the challenge of maintaining our data model after our application has been released into production and how Code First Migrations helps us with propagating data model changes to the database. Then we'll see how to enable migrations for our project, create our first migration, and update our database. We'll also see how the Migration Fluent API is used within migration classes and how to seed our database using the migrations Configuration class.
12 steps-
What are Migrations?
4:41
-
Enabling Migrations
6:06
-
Code First Migrations Review
5 questions
-
The Configuration Class
2:09
-
Adding Our First Migration
4:05
-
The Migration Fluent API
6:04
-
Updating the Database
4:13
-
Populating Our Database with Seed Data
7:31
-
Using the Configuration Class to Add Seed Data
1 objective
-
Excluding Test Data in Production
5:54
-
Using a Preprocessor Directive to Exclude Test Data
1 objective
-
Section Review
10 questions
Digging Deeper Into Migrations
Now that we have a basic understanding of what migrations are and how they work, let's make a change to our data model and add a migration for that change. We'll also see how we can not only upgrade our database, but also downgrade it. And we'll look at an example of a data model change that'll require us to modify the migration that EF generates for us. Then we'll wrap up with an overview of workflows and environments and the various deployment options that Code First Migrations provides.
6 stepsTeacher
-
James Churchill
Before joining the Treehouse team, James worked as a consultant for over 10 years doing web development using .NET and variety of open source technologies. James enjoys participating in the developer community, presenting at and attending meetups, code camps, and conferences. When not working, James enjoys learning, skiing, playing music, and watching movies.