c# - Type interference in the call join -


i have built short , sweet join query try , feel on how create join. managed in sql. i'm not sure how in linq.

linq:

public iqueryable<departmentbreakdownreport> getdepartmentbreakdown     (int supplierid, int reviewperiodid) {     return (from detail in camonlinedb.details             join suppdepp in camonlinedb.suppdepts                 on new { detail.clientid, detail.categoryid }             equals new { suppdepp.clientid, suppdepp.categoryid }             select detail.clientid + "" + detail.categoryid); } 

edit: ignore parameters brought in, cater once have join working.

you returning iqueryable<string> rather assume want iqueryable<departmentbreakdownreport>. return type, need project in select specifying type, this:

return (from detail in camonlinedb.details         join suppdepp in camonlinedb.suppdepts             on new { detail.clientid, detail.categoryid }         equals new { suppdepp.clientid, suppdepp.categoryid }         select new departmentbreakdownreport         {             property1 = detail.property1,             //your properties here         }); 

Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -