I have written this code
IQueryable sites = context.MainTable.Include(\"RelatedTable\"); if (!string.IsNullOrEmpty(param1)) { sites = sites.
It work me , I just remove the null check;
correct: result=
db.EmpTable.FirstOrDefault().ProjectsAssign.Name,
InCorrect : result=
db.EmpTable!=null && db.EmpTable.FirstOrDefault().ProjectsAssign!=null ? db.EmpTable.FirstOrDefault().ProjectsAssign.Name : null,