c# - Entity Framework Core: The multi-part identifier could not be bound -
we using .net core application (meanwhile running on localhost) , sql database running on sql server receive data from. in following method called inside controller using entity framework core query data in sql database:
public actionresult inspectiondetails(string inspectionid, string lang) { // load checks inspection var inspectionchecks = (from ic in _context.inspectedchecks.where(x => x.inspectionid.tostring() == inspectionid) cp in _context.checkpoints.where(x => x.categoryid == ic.categoryid && x.checkid == ic.checkid) tchecks in _context.translations.where(x => x.translationkey == cp.title && x.lang.tolower() == lang.tolower()).defaultifempty() tchecksfallback in _context.translations.where(x => x.translationkey == cp.title && x.lang.tolower() == "en").defaultifempty() select new inspectedchecks2 { id = ic.id, checkdate = ic.checkdate, category = ic.categoryid.tostring(), check = tchecks.textvalue ?? tchecksfallback.textvalue, checkinguser = ic.checkinguser, result = ic.result, passed = ic.passed, inspectionid = ic.inspectionid, tolerancevalue = ic.tolerancevalue, images = null, unit = ic.unit }).tolist(); return content(jsonconvert.serializeobject(inspectionchecks)); }
if inspectiondetails method called following exception thrown:
system.data.sqlclient.sqlexception: "the multi-part identifier "x0.title" not bound. multi-part identifier "x0.title" not bound."
further infromation: "cp" contains disired values, works fine till there.
what tried far:
- run same query directly on sql database --> success
- run 2 querys in inspectiondetails method (first query: set var value of "cp", second query: above, except using new var insted of "cp") --> no success
anyone had similar issue or knows how fix it?
thanks in advance
Comments
Post a Comment