Unable to generate an explicit migration in entity framework

后端 未结 28 1306
情书的邮戳
情书的邮戳 2020-12-12 23:31

I am adding a new migration but this message shows:

Unable to generate an explicit migration because the following explicit migrations are pending:

28条回答
  •  时光说笑
    2020-12-12 23:42

    Tip: It's always good to use the -Script switch for migration commands if you're not sure. It also really helps understand what Update-Database actually does.

    I run the following to update the database, then I get a script I can apply manually (or just run it again without the -Script tag).

    For Update-Database I would run the following :

    Update-Database -Script -ConfigurationTypeName Configuration_ASPNETIdentity -ConnectionStringName SQL_AzureLive

    Where SQL_AzureLive is the named connection string in my config.

    Then I can verify the SQL looks right, apply it and be done. As many others have said if the connection string is wrong or invalid you'll get this error.

提交回复
热议问题