0

我有一个 WCF 数据服务。我不能使用这种格式(长篇大论,中间的代理类)我正在尝试编写这个 LINQ 查询:

from w in je.Streets
where w.CityId == (int)cb_City.EditValue
select new
    {
      HebName = w.HebName,
      EngName = w.EngName,
      ID = w.StreetID
     }).ToList();

像这样

ServiceEntities se = new ServiceEntities();
se.Streets.Where(s => s.CityId == (int)cb_City.EditValue).Select( ???????? ).ToList();

我没有成功,我得到

Error translating Linq expression to URI: Can only specify query options (orderby, where, take, skip) after last navigation.

有人可以帮忙吗???

谢谢

4

2 回答 2

0

试试这个

se.Streets.Where(s => s.CityId == (int)cb_City.EditValue)
              .Select(s => new { 
                    HebName = s.HebName,
                    EngName = s.EngName,
                    ID = s.StreetID
              }).ToList();
于 2012-04-29T12:30:09.100 回答
0

试试这个

je.Streets.Where(w = > w.CityId == (int)cb_City.EditValue).Select(x => 
   new {
          HebName = x.HebName,
          EngName = x.EngName,
          ID = x.StreetID
 }).ToList();
于 2012-04-29T13:15:35.980 回答