相关疑难解决方法(0)

EntityFramework.dll中出现"System.InvalidOperationException"类型的异常,但未在用户代码中处理

我正在尝试为部门名称制作下拉列表.我正在使用MVC5.我在堆栈溢出上看到了太多的解决方案,但我从未找到与MVC5相关的有价值的解决方案.

Database Name : AppraisalDBContext
Table Name :  Department
Column Name : deptID (Primarykey)
              deptName (department name)
              Description 
Run Code Online (Sandbox Code Playgroud)

我收到此错误:

An exception of type 'System.InvalidOperationException' occurred in  EntityFramework.dll but was not handled in user code

Additional information: The model backing the 'AppraisalDBContext' context has changed since the database was created.Consider using Code First Migrations to update the database (http://go.microsoft.com/fwlink/?
Run Code Online (Sandbox Code Playgroud)

码:

控制器类名称(DepartmentController.cs):

public ActionResult Index(string depName)
{
    var DeptLst = new List<string>();          
    var GenreQry = from d in db.Department
                   orderby d.deptName
                   select …
Run Code Online (Sandbox Code Playgroud)

c# asp.net asp.net-mvc-4

5
推荐指数
1
解决办法
6万
查看次数

标签 统计

asp.net ×1

asp.net-mvc-4 ×1

c# ×1