i am using ASP.NET MVC and EF and in my controller i am using something like this:
public ActionResult Index()
{
using (MyEntities db = new MyEntities())
{
var _info = db.INFORMATION;
return View(_info);
}
}
and it throws me the below error. (if i use using statements )
error:
The ObjectContext instance has been disposed and can no longer be used for operations that require a connection.
and in my VIEW i am calling like this:
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<MVC_EF_Model.INFORMATION>" %>
<% foreach (var item in Model) { %>
<tr>...........
..............