2012-04-29 96 views
0

我有一個WCF數據服務。我不能使用這種格式(長的故事,中間代理類) 我試圖寫這個LINQ查詢: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. 

有人可以幫助嗎?

謝謝

回答

0

試試這個

se.Streets.Where(s => s.CityId == (int)cb_City.EditValue) 
       .Select(s => new { 
        HebName = s.HebName, 
        EngName = s.EngName, 
        ID = s.StreetID 
       }).ToList(); 
0

試試這個

je.Streets.Where(w = > w.CityId == (int)cb_City.EditValue).Select(x => 
    new { 
      HebName = x.HebName, 
      EngName = x.EngName, 
      ID = x.StreetID 
}).ToList();