Using EF4 migration tool with model-first approach

Johnny5 picture Johnny5 · Apr 16, 2012 · Viewed 8k times · Source

EF migration utility seems quite nice when using code first.

Based on this blog post, I tried setting it in my project where we use model-first. When running Enable-Migrations command, I get the following error:

Creating a DbModelBuilder or writing the EDMX from a DbContext created using Database First or Model First is not supported. EDMX can only be obtained from a Code First DbContext created without using an existing DbCompiledModel.

Is there any way around it so we can use the EF migration without switching to code-first?

Answer

artisonus picture artisonus · May 11, 2012

I was looking for the same solution and found this: Entity Designer Database Generation Power Pack After installation, when you choose "Generate Database from Model..." it'll popup a new wizard and you can choose "Generate Migration T-SQL".