Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Including your title in your question, my guess is you do not experience the problem (yet) without the debugger attached.<br/> As others have commented it is due to <code>LazyLoading</code>.<br/> The problem may occur sometimes because while rendering the <code>View</code> the entities container is being disposed, most probably because it is collected by the GarbageCollector which calls the destructor of the container.<br/><br/> If you wish to access the entities on your <code>View</code> you can use <code>Include</code> on the <code>ObjectSet</code>. Let's say <code>MeetingPurposes</code> has an associated <code>EntitySet</code> of <code>Dates</code>: If you wish to include them in the loadoperation you can do the following: <code>db.MeetingPurposes.Include("Dates").ToList();</code></p> <pre><code>public ActionResult GetMeetingMR(int id = 0) { //Load the MeetingPurposes including their dates var meetingPurpose = db.MeetingPurposes.Include("Dates").ToList(); ViewBag.MeetingPurpose = new SelectList(meetingPurpose, "MeetingPurposeID", "MeetingPurposeName"); ViewBag.MRID = id; List&lt;Meeting&gt; meetings = (db.MortgageRequests.Find(id)).Meetings.ToList(); return View(meetings); } </code></pre> <p>If you wish to do this for <code>Meetings</code> and Meetings has an <code>EntitySet</code> of <code>Dates</code> you could do:</p> <pre><code>public ActionResult GetMeetingMR(int id = 0) { var meetingPurpose = db.MeetingPurposes.ToList(); ViewBag.MeetingPurpose = new SelectList(meetingPurpose, "MeetingPurposeID", "MeetingPurposeName"); ViewBag.MRID = id; var meetings = (from mee in db.Meetings.Include("Dates") join mga in dbo.MortgageRequests.Where(m =&gt; m.Id == id) on mee.MortgageRequestID equals mga.ID select mee).ToList(); return View(meetings); } </code></pre> <p>Not really sure what your <code>Find</code> extension method is so I used a <code>Where</code> on <code>MortgageRequests</code>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload