我正在使用LINQPad运行以下查询:
var pds = (from p in Projects
group p by p.FiscalYearVariables.FiscalYear into grouped
where grouped.Count() > 0
select new {
fiscalYear = grouped.Key,
projectDetails = grouped.SelectMany(a=>a.ProjectDetails),
Programs = (from pwbs in Programs.SelectMany(a =>a.ProgramWbsNumbers)
let ds = pwbs.WbsNumbers.DisplayString
where pwbs.Programs.IsActive
&& (from w in WbsNumbers
where w.DisplayString.StartsWith(ds)
select w).Any()
select pwbs.Programs)
});
pds.Dump();
我收到错误:
NotSupportedException:String.StartsWith方法仅支持可在客户端上计算的参数。
我不确定如何纠正此错误。如果有帮助的话,我需要将Program
的{{1}}开始于WbsNumber
中包含的WbsNumber
。{/ p>
答案 0 :(得分:8)
试试这个:
where SqlMethods.Like(w.DisplayString, ds + "%")