Entity Framework Migration Adding Column Twice

点点圈 提交于 2019-12-10 21:27:09

问题


I'm running Entity Freamework Code First Migrations. When trying to run the application I get the error: A column ID occurred more than once in the specification. I have AutomaticMigrationsEnabled set to true in the configuration because when I run the project, I want the migrations to run automatically.

This is the verbose results when I tried running it through the package manager:

Applying code-based migration: 201211261626569_AddActiveFlagForProjects.

ALTER TABLE [Projects] ADD [Active] [bit] NOT NULL DEFAULT 1

[Inserting migration history record] Applying automatic migration: 201211261901371_AutomaticMigration.

ALTER TABLE [Projects] ADD [Active] [bit] NOT NULL DEFAULT 0

Why is EF trying to alter the projects table twice?

I'm using Entity Framework 5.0 and SQL CE 4.0.


回答1:


Adding -IgnoreChanges flag to Add-Migration

http://entityframework.codeplex.com/workitem/652



来源:https://stackoverflow.com/questions/13571576/entity-framework-migration-adding-column-twice

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!