实体框架6 - 启用迁移时不创建表 [英] Entity Framework 6 - Does not create tables when enabling Migrations
问题描述
当我运行测试时,Entity Framework创建一个空数据库,并尝试在该空数据库上运行迁移,并引发指定的表不存在。
基于这个报告我认为实体框架6中的迁移使用已经改变。
我使用 Context.Database.Create();
测试所有的数据库初始化程序,但在所有情况下,tabale从未创建。
我不知道这是EntityFramework的错误,但是当我将Migration Configuration类的命名空间从默认(Projectname / Migrations)重命名为任何无默认名称,迁移工作良好。
In my application I enable Code First Migrations with some migrations, Also I use SQL Server Compact for integration test.
When I run my tests, Entity Framework create an empty database and tries to run migration on that empty database and thrown The specified table does not exist.
Based on this report I think usage of Migration in Entity Framework 6 has changed.
I test all Database Initializer with Context.Database.Create();
but in all case tabale's never created.
I don't know that this is EntityFramework's bug or not, but when I made rename the namespace of Migration Configuration class from default (Projectname/Migrations) to any none default name, migration works well.
这篇关于实体框架6 - 启用迁移时不创建表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!