This will be coming soon as a NuGet package called EntityFramework.Migrations
A demo was performed by Scott Hanselman at TechEd 2011 (available online at http://channel9.msdn.com/Events/TechEd/NorthAmerica/2011/DEV349). The relevant section is 45 minutes in.
In short, once the package is installed, you'll enter the following into the Package Manager Console to generate a database change script:
migrate -script
UPDATE (13-Nov-2011)
The alpha 3 build of this package is now available on NuGet. Rather than use the cmdlet migrate -script
mentioned above, it uses the cmdlet Add-Migration <migrationname>
. A walk-through of its use can be found on the ADO.NET team blog.
UPDATE (14-Feb-2012)
This functionality is now available as part of the main EntityFramework NuGet package, starting with version 4.3. An updated walk-through using EF 4.3 can be found on the ADO.NET team blog.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…