I have Corporates
and EmployeeEvaluations
EF classes. I am performing a Left outer join and when I use the LINQ statement to get the count
I am getting the following error even though I am checking for null :
Object reference not set to an instance of an object.
CompanyBO result = new CompanyBO();
try
{
using (CompEntities db = new CompEntities())
var res = await(from c in db.Corporates
join ee in db.EmployeeEvaluations on esj.Id equals
ee.EmployeeId into eels
from eelsj in eels.DefaultIfEmpty()
select new { corp = c, empEvals = eelsj }
).ToListAsync();
result.Qualified = res.Where(a => a.empEvals.EvaluationStatusId != null).Count(a => a.empEvals.EvaluationStatusId == 3);
}