entity-frameworkentity-framework-4.1ef-code-firstdatabase-diagram

Prevent EF 4.1 from deleting my database diagram


Is there a way to prevent Entity Framework Code-First from deleting my database diagrams when it is re-building my database?


Solution

  • Without using DropCreateDatabaseIfModelChanges to create your database you can use SQL Migrations
    http://www.hanselman.com/blog/EntityFrameworkCodeFirstMigrationsAlphaNuGetPackageOfTheWeek10.aspx. It won't drop the database and will generate alter commands (Incremental database development) . So you can keep your diagram and existing data.