1
我有Linq查詢爲:Sql的Linq ISNULL在where子句中不工作
var notstartedcount = (from te in context.EH_PP_TeacherEvaluations
join tesrt in context.EH_PP_TeacherEvaluationStatusesRefTables
on te.EH_PP_TESRT_TeacherEvalStatusID equals
tesrt.EH_PP_TESRT_TeacherEvalStatusID
where tesrt.EH_PP_TESRT_TeacherEvalStatusID.Equals("1") ||
tesrt.EH_PP_TESRT_TeacherEvalStatusID.Equals("")
select te).Count();
我只是想讓Isnull(ColumnName,replacement)
在狀態,我們在SQL做。
例如:
where isNull(EH_PP_TESRT_TeacherEvalStatusID,0)=1
我一直在相同的條件下對LINQ爲:
var notstartedcount = (from te in context.EH_PP_TeacherEvaluations
join tesrt in context.EH_PP_TeacherEvaluationStatusesRefTables
on te.EH_PP_TESRT_TeacherEvalStatusID equals
tesrt.EH_PP_TESRT_TeacherEvalStatusID
where
isnull(tesrt.EH_PP_TESRT_TeacherEvalStatusID.Equals(Null),0).Equals("1") ||
tesrt.EH_PP_TESRT_TeacherEvalStatusID.Equals("")
select te).Count();
但其在LINQ的情況下錯誤。
我怎樣才能把它的條件?