entity framework - The Include path expression must refer to a navigation property defined on the type -
i have following repository method:-
public accountdefinition getcustomer2(int id) { var c = entities.accountdefinitions .where(p=>p.org_id==id) .include(a => a.sdorganization) .include(a2 => a2.sitedefinitions) .include(a3 => a3.sdorganization.aaapostaladdresses) .include(a4 => a4.sitedefinitions.selectmany (a5 => a5.departmentdefinitions.selectmany (a6 => a6.sdusers.select (a7 => a7.aaauser)))) .singleordefault(); return c; }
the following action method calls above method:-
public actionresult details2(int id = 0) { accountdefinition cd = repository.getcustomer2(id); return view("copy",cd); }
but when navigate action method , following error on repository class:-
the include path expression must refer navigation property defined on type. use dotted paths reference navigation properties , select operator collection navigation properties.
so wrong code?
i think may want like
public accountdefinition getcustomer2(int id) { var c = entities.accountdefinitions.where(p=>p.org_id==id) .include(a => a.sdorganization) .include(a2 => a2.sitedefinitions) .include(a3 => a3.sdorganization.aaapostaladdresses) .include(a4 => a4.sitedefinitions.select(a5 => a5.departmentdefinitions.select(a6 => a6.sdusers.select(a7 => a7.aaauser)))); return c; }
Comments
Post a Comment