gpt4 book ai didi

c# - 在 mvc 4 中找不到 DbContext

转载 作者:太空狗 更新时间:2023-10-29 20:44:50 24 4
gpt4 key购买 nike

我正在使用 Visual Studio 2012Framework 4.5 创建一个 Web 应用程序,我正在使用 MVC 4 但我被卡住了有问题。

我需要使用 DbContext 但我在我的项目中找不到这意味着我添加了 System.Data.Entity 并且它仍然给出错误

The type or namespace name 'DbContext' could not be found (are you missing a using directive or an assembly reference?)

我该如何解决这个...?

最佳答案

DbContext 位于 EntityFramework.dll 中。 See this for reference

你可以通过在PMC中输入这个命令从nuget获取它

Install-Package EntityFramework -Version 5.0.0

您可以通过在 VS 中转到工具 -> 库包管理器 -> 包管理器控制台 进入 PMC

关于c# - 在 mvc 4 中找不到 DbContext,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16314715/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com