【发布时间】:2013-09-01 09:10:22
【问题描述】:
我在我的 MVC 网站中使用实体框架,并使用 using 语句处理我的数据库上下文。现在我的问题是,如果我在返回后关闭 using 语句,数据库上下文是否会正确处理。例如:
public ActionResult SomeAction(){
using (var DB = new DatabaseContext()){
....
return View();
}
}
在返回之前我必须关闭 using 语句吗?或者它会以我使用它的方式正确处理。
【问题讨论】:
标签: asp.net-mvc entity-framework asp.net-mvc-4 using