The ADO.NET at Microsoft announced the release of Alpha 3 of Code First Migrations. “Alpha 3 is still is primarily focused on the developer experience inside of Visual Studio. “This release adds most of development time features we plan to include in the first RTM,” said the the team.
“Alpha 3 is focused on adding the remaining features that you have been asking for around development time migrations.” The primary changes in Alpha 3 are:
- “VB.NET migration generation is now available.
- Upgrade/Downgrade to any migration is now available via the -TargetMigration switch.
- Seed data can now be added by overriding the Seed method of the Settings class. Data is expressed in terms of the current model and the Seed method is called after upgrading to the latest migration.
- We removed TargetDatabase from the Settings class. Instead you can use the -TargetDatabase switch to specify the name of a connection string from your App/Web.config file.
- You can now start using Code First Migrations against an existing database that was created by Code First. To do this issue an Update-Database command when you model is the same as the model that created the database. To use this feature the EdmMetadata table must be present in the database. This original creation of the database and tables will be counted as an automatic migration, if you want a code-based migration for the initial create of the database and tables you must drop the database and begin using migrations against an empty or non-existent database.
- Improved error logging when an exception is encountered.
- The bugs that required SQL Compact and SQL Express to be available are now resolved,” the team blog informed.
Also, there’re two walkthroughs for Alpha 3: “one focuses on the no-magic workflow that uses a code-based migration for every change,” while the other “looks at using automatic migrations to avoid having lots of code in you project for simple changes,” the team added.
- Code First Migrations: Alpha 3 ‘No-Magic’ Walkthrough
- Code First Migrations: Alpha 3 ‘With-Magic’ Walkthrough (Automatic Migrations)