我正在尝试运行自定义查询并且我正在使用实体框架,我尝试了这个
string query = @"SELECT dm.DistrictName,sm.SchoolName,u.UserId,u.FirstName,u.LastName, sa.StudentId, sa.ReadingLevel
FROM studentassessment sa
INNER JOIN assessmentmaster am ON sa.AssessmentId = am.AssessmentId
INNER JOIN studentclass sc ON sa.StudentId = sc.StudentId
INNER JOIN USER u ON sc.TeacherId = u.UserId
INNER JOIN schoolmaster sm ON u.SchoolCode = sm.SchoolCode
INNER JOIN districtmaster dm ON sm.DistrictId = dm.DistrictId
WHERE u.RoleId = 5 && sa.GradeId = " + objParam.Grade + " && sa.AssessmentPeriodId = " + x.AssessmentPeriodId + " && dm.DistrictId = " + districtCode + " && am.DRAType = '" + objParam.LanguageType + "' && am.AssessmentTypeId = 1";
var dt = db.ExecuteStoreQuery<List<object>>(query).FirstOrDefault();
但是没有成功。
有没有办法ExecuteStoreQuery
从未映射到任何对象类型的结构中获取结果?