基本上,我遵循了一个教程,然后决定删除.mdf
文件。
现在,每当我尝试运行应用程序时,我都会得到以下错误(此线程的标题)。我得到错误的代码如下所示(ASP.NET mvc4):
OdeToFoodDB db = new OdeToFoodDB();
public ActionResult Index()
{
var model = db.Restaurants.ToList();
return View(model);
}
我的连接字符串如下:
<add name="DefaultConnection"
connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=OdeToFoodDb;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\OdeToFoodDb.mdf"
providerName="System.Data.SqlClient" />
我尝试过查看SQL Server对象资源管理器,但它看起来如下所示:
此外,在服务器资源管理器中,我看不到任何数据连接。
当我尝试在服务器资源管理器中添加新连接时,我看不到任何名为OdeToFoodDb
的数据库。
对于这个宽泛的问题,我很抱歉,但我是实体框架的新手,不太明白这里有什么问题。
https://stackoverflow.com/questions/17012839
复制相似问题