This question is locked. New answers and comments are not allowed.
When fetching objects from the database using a where clause, the results aren't always 100% complete. See the example below:
var missingcourseList =
this
._database.GetAll<Course>().Where(o => o.Id == 1386).ToList();
missingcourseList = missingcourseList .Where(o => o.IsValidated
&& (!o.Private || o.EmployerRegistrations.Any(p => p.Employer == zone))
&& (o.Organiser ==
null
|| o.Organiser != zone)
&& o.Education
is
InheritedCourse
&& o.CourseEvents.Max(p => p.Date) >= DateTime.Today)
.OrderBy(o => o.CourseEvents.Min(p => p.Date))
.ToList();
var publicCourses =
this
._database.GetAll<Course>()
.Where(o => o.IsValidated
&& (!o.Private || o.EmployerRegistrations.Any(p => p.Employer == zone))
&& (o.Organiser ==
null
|| o.Organiser != zone)
&& o.Education
is
InheritedCourse
&& o.CourseEvents.Max(p => p.Date) >= DateTime.Today)
.OrderBy(o => o.CourseEvents.Min(p => p.Date))
.ToList();
The missingCourse is not included in the publiccourses query, even though it's using the exact same linq where clause.