2014-02-21 65 views
0

嗨我有困难编写我的linq查询。不知道在哪里把我的Where子句。Linq的故障在哪里子句

using (var ctx = DB.Get()) 
     { 
      Interaction = new BindableCollection<InteractionDTO>(
       ctx.Interactions.Select(
       x => new InteractionDTO 
       { 
        Indepth = x.Indepth 
       } 
       ) 
      ); 
     } 

我在哪里放这段代码,或者我怎么写它的方式,它将与上面的语法一起工作。 where date>= StartDate.SelectedDate.Value

+0

是'date'或''StartDate'的Interactions'一员? –

+0

日期是交互的成员抱歉,关于混淆 – Master

回答

2

像这样的东西应该工作

ctx.Interactions. 
    .Where(x => x.date >= StartDate.SelectedDate.Value) 
    .Select(x => new InteractionDTO 
      { 
       Indepth = x.Indepth 
      }) 
2

试试这个

  ctx.Interactions 
      .where (x=> date >=x.StartDate) 
      .Select(x => new InteractionDTO 
      { 
       Indepth = x.Indepth 
      });