且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Entity Framework 6 - 启用迁移时不创建表

更新时间:2023-02-03 18:17:00

我不知道这是否是EntityFramework的错误,但是当我将迁移配置类的命名空间从默认(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.