ASP.NET MVC + ORACLE +实体框架错误:无法生成显式迁移

时间:2018-12-18 18:47:56

标签: c# asp.net-mvc oracle

我在Visaul Studio Professional 15.9.3,APS.NET MVC框架4.8和Oracle DB Express 11G和实体框架6.2.0中。启用迁移后,一切正常,我可以进行第一个迁移“ add-migration Initial”并进行“ update-database”更新。

所有表都正确显示在我的数据库上,但是当我想进行另一次迁移时我遇到此错误由于以下未完成的显式迁移未完成,因此无法生成显式迁移:[201812181830095_Initial ]。在尝试生成新的显式迁移之前,请先应用待处理的显式迁移。

在我的控制台中:

PM> enable-migrations
Checking if the context targets an existing database...
Code First Migrations enabled for project project.Web.
PM> add-migration Initial -verbose
Using StartUp project 'project.Web'.
Using NuGet project 'project.Web'.
Scaffolding migration 'Initial'.
The Designer Code for this migration file includes a snapshot of your current Code First model. This snapshot is used to calculate the changes to your model when you scaffold the next migration. If you make additional changes to your model that you want to include in this migration, then you can re-scaffold it by running 'Add-Migration Initial' again.
Target database is: '' (DataSource: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=XE))), Provider: Oracle.ManagedDataAccess.Client, Origin: Configuration).
PM> update-database
Specify the '-Verbose' flag to view the SQL statements being applied to the target database.
Applying explicit migrations: [201812181830095_Initial].
Applying explicit migration: 201812181830095_Initial.
Running Seed method.
PM> add-migration Add-Desc-Name
Unable to generate an explicit migration because the following explicit migrations are pending: [201812181830095_Initial]. Apply the pending explicit migrations before attempting to generate a new explicit migration.

什么可能会使我出现这种错误?

我的第一次迁移和更新始终有效,而第二次却没有。

感谢您的帮助!

0 个答案:

没有答案