EF migration shows empty Up() Down() methods

后端 未结 17 2396
花落未央
花落未央 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条回答
  •  再見小時候
    2020-12-25 10:13

    In my case, I was encountering similar problems with Visual Studio Code.

    I have fixed these by doing the following:

    1. Check inside your ContextModelSnapshot : ModelSnapshot
    2. Comment Model Entity Definition…
    3. Delete your migration files related to these entity
    4. Delete the migrations from the dbo.__EFMigrationsHistory table
    5. Compile your solution.
    6. Run the following commands:
    dotnet ef migrations add migrationName -p ProjectContainer/ 
    dotnet watch run 
    

提交回复
热议问题