get data by linq but have Error when doit this

42 Views Asked by At

I have this Error

use casting ('t => ((Derived)t).MyProperty') or the 'as' operator ('t => (t as Derived).MyProperty'). Collection navigation access can be filtered by composing Where, OrderBy(Descending), ThenBy(Descending), Skip or Take operations. For more information on including related data, see http://go.microsoft.com/fwlink/?LinkID=746393.'

this my code

enter image description here

enter image description here

enter image description here

i want get Employee name

this path on the images

TBEmployeePc > TBEmployee > EmployeeName (i want get this "EmployeeName")

any ideas

1

There are 1 best solutions below

0
Qing Guo On

TBEmployeePc > TBEmployee > EmployeeName (i want get this "EmployeeName")

Try:

var pc=Octx.TBEmployeePc.Include(x=>x.TBEmployee).ToList();
var namelist = pc.Select(o => o.TBEmployee.Select(c => c.EmployeeName)).ToList();