c# - Projecting Anonymous to Entities not mapping navigation Property -
my table structure this:
- table department has 1 one relationship table employee
- table employee has 1 many relationship table projects
- table projects has 1 many relationship table issues
- table employee has 1 many relationship table issues also.
note: there join table "employeeprojects" (employeeid, projectid). table reference table, not mapped ef , no model generated it
var iqurableresult = datacontext.department .include("employee") .include("employee.projects") .include("employee.projects.issues") .where(filter => filter.isselected && filter.filterid == filterid) .select(x => new { dep = x, emp = x.employee. projects = x.employee.projects.where(g=>g.id==10) //project _issues = x.employee.projects.where(g=>g.id==10).select(x=>x.issues) }).tolist(); at point, i'm getting data in iqurableresult , filtered data fetched in anonymous list.
when try project them entity, i'm not able employee's projects. code below.
var tableblist = iqurableresult.select(y=>y.dep).tolist(); my findings
i assume while projecting, employee couldn't find relationship table projects hence not mapped, table issues mapped in table employee.
how should fetch data relate employee , projects?
Comments
Post a Comment