【发布时间】:2015-09-24 03:13:33
【问题描述】:
请客气,我是 c# 的新手。
我的controller 收到此异常:
public ActionResult Index()
{
return View(db.Tickets.ToList());
}
这就是我的model 的样子:
public class Ticket
{
public int ticketID { get; set; }
public string ticketTitle { get; set; }
}
我收到此错误的任何想法。提前致谢。
【问题讨论】:
-
以上代码中的db是什么?
-
私有 BugTrackerContext db = new BugTrackerContext();
-
这可能会有所帮助,请参阅此帖子:stackoverflow.com/questions/20541056/…
-
作为最佳实践,将您的 BugTrackerContext 放在 using 语句中。
-
检查内部异常。它是否提供更多信息? stackoverflow.com/questions/27777004/…
标签: c# .net entity-framework model-view-controller ef-code-first