が配置されている、私は私のコントローラ上の非常に単純なアクションを持っていると私はThe operation cannot be completed because the DbContext has been disposed.
表は、JSONのエラーに - DbContextは私DBContextだけで動作していない何らかの理由で
私の単純なコードは次の通りである。このエラーを取得しています(.toListは()データのみが読み取られていると私は102個の要素のリストを持っているconfrimするデバッグ用です。)
public ActionResult gettimeoffsets()
{
using (Dal.DbContext dc = new Dal.DbContext())
{
var times = dc.timeZones;
var timelist = times.ToList();
return Json(times, JsonRequestBehavior.AllowGet);
}
}
これは私のタイムゾーンモデル
[Table("timeZones")]
public class timeZone
{
[Key]
public String Id { get; set; }
public String BaseUtcOffset { get; set; }
public String DisplayName { get; set; }
public Double tzOffset { get; set; }
}
私はDbsetが返されなかったことはありませんでした、ありがとう –