Maintaining data when using Entity Framework database script
I am reading the Pro Entity Framework 4.0 book by Scott Klein and the author points out that
Your database will be recreated from scratch when the DDL script is run. No existing data will be 开发者_Go百科saved. If you have data that you wish to save, you must save and restore it yourself.
What procedures/tools do people use in practice that work best for them?
the DDL script can only create tables and other schema properties (no data), but if you want the data too what I use is.
Step 1. Script out the DDL based on the current Database
Step 2. Rename the original database to something else
Step 3. Download Redgate toolbelt, and use SQL data compare (there is a trail version)
Step 4. Use Redgate SQL DataCompare to compare Old DB to the new DB
Step 5. Generate the script to migrate the data. and your done!
Now you can run this script anytime after you run the DDL script to restore your db to that point in time.
精彩评论