fiz*_*mhd 12 asp.net-mvc entity-framework
我正在制作一个ASP.NET MVC项目......当我输入enable-migrations时,我得到以下的eroors:
More than one context type was found in the assembly 'eManager.Web'.
To enable migrations for eManager.Web.Infrastructure.DepartmentDb, use Enable-Migrations -ContextTypeName eManager.Web.Infrastructure.DepartmentDb.
To enable migrations for eManager.Web.Models.UsersContext, use Enable-Migrations -ContextTypeName eManager.Web.Models.UsersContext.
Run Code Online (Sandbox Code Playgroud)
Paw*_*wel 36
错误消息准确地说明了问题是什么以及需要做什么 - 包括需要发出的命令.显然,您的项目中有多个上下文(Web.Infrastructure.DepartmentDb和Web.Models.UsersContext),并且迁移不知道应该启用哪些迁移.您需要指向上下文类型.根据错误消息使用:
Enable-Migrations -ContextTypeName eManager.Web.Infrastructure.DepartmentDb.
Run Code Online (Sandbox Code Playgroud)
为eManager.Web.Infrastructure.DepartmentDb启用迁移
Enable-Migrations -ContextTypeName eManager.Web.Models.UsersContext.
Run Code Online (Sandbox Code Playgroud)
启用eManager.Web.Models.UsersContext的迁移
| 归档时间: |
|
| 查看次数: |
25567 次 |
| 最近记录: |