title: Sum of child of child in LINQ
body: <p>I need help in LINQ query in EF6.</p>
  
  <p>the master table is called <code>EXAM</code>. its child is <code>ExamResult</code>.
  each <code>ExamResult</code> has a <code>Question</code> and the selected <code>Answer</code>.
  each <code>Answer</code> has <code>power</code> (0 if wrong, 1 if correct).
  if I want to know the total of correct answers, I simply run the command:</p>
  
  <pre><code>var examTotal = db.Exams.FirstOrDefault(ex =&gt; ex.ExamID == examId).ExamResults.Sum(er =&gt; er.Answer.Power);
  </code></pre>
  
  <p>my problem is when some questions were not answered, and I get <code>NullReferenceException</code>. </p>