Entity Framework code first migrations throwing error

后端 未结 9 1624
再見小時候
再見小時候 2021-02-13 20:17

Here is what I did before I got this error:

  1. Installed EF (the pre release version, 6 maybe, I dunno)
  2. decided I did not want, so uninstalled that and reins
9条回答
  •  一向
    一向 (楼主)
    2021-02-13 20:30

    I believe I could figure out a solution. I had several projects in my solution.

    enter image description here

    My database logic was in SqlDataAccess. The assembly was reference in WebUI.

    I started off at the DomainLogic. Define POCOs for repository base classes there.

    Then I added SqlDataAccess project.

    and tried Enable-Migrations, Add-Migration and Update-Database command. It ran fine. After I added WebUI (an MVC 4 based web application to the project and ran the commands above. I started getting this version error.

    I unload the project WebUI and re ran the command. And it ran fine again. So, Even if it's not the best solution you might want to unload other projects leaving the atabase project in the solution and then running these commands. It worked for me. All the best!

提交回复
热议问题