다음을 통해 공유


Migrations Screencast Series

We recently published a three part series on using Entity Framework Code First Migrations. The short series is designed to help you use migrations in the ‘real world’ where you often work in a development team and/or have to write applications that interact with existing database schemas.

The screencasts cover some concepts using diagrams and then show these concepts in action with a demo in Visual Studio.

UnderTheHood

Migrations – Under the Hood

This screencast digs into how migrations works, including how it detects changes to the model by storing model snapshots in each migration.

This is useful for all developers to know, but also a pre-requisite to understanding the concepts in the other two screencasts.

TeamEnvironments

Migrations – Team Environments

This is the companion screencast to our Code First Migrations in Team Environments documentation.

This screencast covers using Code First Migrations in a development team, where two or more developers are working on the same project, using a source control system.

ExistingDatabases

Migrations – Existing Databases

This is the companion screencast to our Code First Migrations with an existing database documentation.

This screencast covers how to enable migrations for an existing database and then use migrations to propagate changes in your Code First model to the database.

Comments

  • Anonymous
    March 12, 2014
    Rowan, good videos for understanding. Is there any or can you do a blog post or video for users that used automatic migrations and later decide to go to code based migrations? With possibly different model versions out in the wild? Asking for a friend ;) Thanks, Thomas

  • Anonymous
    March 14, 2014
    Great videos! Didacticaly perfert! It just helped me to solve a problem I was struggling with by explaining me why! Thanks Rowan, this is a really good job

  • Anonymous
    March 18, 2014
    @Thomas K. - Actually shouldn't be too hard to solve, provided you are happy to leave all migration up to the point you swap to code based migrations as automatic. If you just generate a code based migration then EF will just use automatic migrations to migrate to the model to the state of the model before you generated the first code based migrations and then use code based migrations from that point on. It achieves this by storing an extra snapshot of the model in the code based migration (state of model before the changes in the migrations were applied - in addition to the current snapshot of the model including the changes).

  • Anonymous
    April 01, 2014
    Dear Miller, I have seen your videos, and I am learning migrations with fluent api, Everything works well, but I try to change the ForeignkeyNamingConventions, but it dosen't work for me, I have to have the following format, for PrimaryKey PK_<TableName> and ForeignKey FK_<RightTableName>_<LeftTableName>, I have seen this link: msdn.microsoft.com/.../dn469439 but dosen't work, or I can't do it Could you help me, please?

  • Anonymous
    April 07, 2014
    @Javier Orrillo - Are you trying to change the name of the actual PK/FK constraints in the database? If so, this can't be done with conventions because the names aren't part of the model. You could do it by customizing the code generator for Migrations to specify the names you want though - romiller.com/.../code-first-migrations-customizing-scaffolded-code.

  • Anonymous
    July 30, 2014
    thanks