Enable Migrations with Context in Separate Assembly?

前端 未结 4 1771
礼貌的吻别
礼貌的吻别 2020-11-29 18:59

I have one project that I want to run my update-database against but I have my Models and Context in a separate project.

If I run enable-migration

4条回答
  •  无人及你
    2020-11-29 19:23

    Here is a workaround:

    Add a class into MyProject(the project for migrations). Make this class inherit the dbcontext(the one in MyProject.MVC).

    Then run EF migration commands on MyProject.

提交回复
热议问题