EF migration shows empty Up() Down() methods

后端 未结 17 2443
花落未央
花落未央 2020-12-25 09:56

I have a local database that is currently in it\'s second version and should now go to it\'s third version.

The code for the previous migrations was generated by ano

17条回答
  •  猫巷女王i
    2020-12-25 10:11

    In my case, the datacontext project is a class lib project. It is different from the startup project which is asp.net mvc 5 project. Now by mistake the connection string in the startup project is pointing to a different database.

    So ensure that datacontext project and startup project point to the same database. Also use the full command as mentioned in the question like the following. You can include -Force as well.

    add-migration "InitialMigration" -verbose -ProjectName "MyEFproject" -Force
    

提交回复
热议问题