Jun 01, 2020 01:23 AM|wavemaster|LINK
My apologies for not being precise.
This query below:
var results = dbContext.ScheduledSvcVisits
.Where(s => s.enteredByProviderId == providerId && (s.visitStatus == "Scheduled" || s.visitStatus== "Invited"))
.OrderBy(s => s.apptDate).ThenBy(s => s.calOId).GroupBy(s => s.apptDate);
if it wasn't for the GroupBy and OrderBy not working would allow me to do this:
foreach (var notice in ScheduledSvcVisits.Appointments.OwnerVisitNotices)
some html @notice.dateSent.ToString("")
I.e. I can navigate through the Entities without ever having to do a join, or know which columns were in a particular table. Just click on the arrows and navigate to where I need to be.
And EF (data first) would tell me that a ScheduledSvcVisits has Appointments, while a Appointment has exactly one Client.
What is making me say "doesn't work right" refers to the Grouping of ScheduledSvcVisits by apptDate AND Ordering by apptDate and calOId.
The result is NOT as expected:
1: apptDate May 24:
1.1 calOId = 2
1.2 calOId = 1
2: apptDate May 27:
2.1 calOId = 1
I am thinking that a GroupBy on apptDate then OrderBy on apptDate and calOId should give me this:
1.1 calOId = 1
1.2 calOId = 2
Or am I mistaken?