Entity Framework 6 Using Lambda GroupBy on a joined table

ساخت وبلاگ

Vote count: 0

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.

asked 37 secs ago

back soft...
ما را در سایت back soft دنبال می کنید

برچسب : نویسنده : استخدام کار backsoft بازدید : 238 تاريخ : جمعه 28 خرداد 1395 ساعت: 21:11