2013-06-22 48 views
0
  using (WinFileContextContainer c = new WinFileContextContainer()) 
      { 
      IQueryable<File> dbfiles = (from f in c.File 
             where //(f.Category.Any((category => category.name == categoryname)) && 
               f.alive //&& 
               //f.description == "" && 
               //f.Category.Count == 1) 
             select f); 
      // the rest.... 
      } 

查詢只能像現在 - 我離開只是一個標準(其餘部分在評論部分)。但我希望其他標準也要考慮在內。我嘗試了多個「where」:D或括號中的所有標準,其中有一個「where」,但仍然沒有成功。我有點新LINQ所以任何幫助表示讚賞。提前致謝 !LINQ到實體:多條件查詢爲一個表

回答

0

終於得到它的工作:

   IQueryable<File> dbfiles = 
      c.File.Where(f => f.Category.Any(cat => cat.name == categoryname) && 
               f.alive && 
               f.description == null && 
               f.Category.Count == 1);