I have two tables, Drivers
and ViewDrivers
that I have joined together using the following lambda expression in Entity Framework 6.
var inAppDriverList = context.ViewDrivers
.Select(dv => new { dv.TerminalCode, dv.EmployeeId })
.Join( context.Drivers, d => d.EmployeeId, dv => dv.EmployeeId, (d, dv) => new { d, dv } )
.OrderBy(dv => dv.TerminalCode)
.GroupBy(dv => dv.TerminalCode)
.ToList();
It does give me the data that I am expecting to get, but I when I try to Sort and Group the list by the TerminaleCode using GroupBy
and OrderBy
, I cannot get it to work correctly. I have tried everything I can think of, with no luck.
I am only having this issue when I am trying to sort a joined table so I am guessing there is something small that I am missing. I would greatly appreciate any help in getting those statements to Group and Sort by the TerminalCode
field.