代码之家  ›  专栏  ›  技术社区  ›  blindmeis

NHibernate Linq-如何创建where语句

  •  7
  • blindmeis  · 技术社区  · 14 年前

    如何使用Nhibernate Linq实现这个查询?

    var l = session.CreateQuery("from Auswahl a where a.Returnkey is not null").List<Auswahl>();
    

    我试过这个,但它总是返回一个空列表。

    var l = session.Linq<Auswahl>()
                       .Where(item => !String.IsNullOrEmpty(item.Returnkey))
                       .Select(item => item)
                       .ToList();
    
    1 回复  |  直到 14 年前
        1
  •  7
  •   Sunday Ironfoot    14 年前

    你试过:

    var l = session.Linq<Auswahl>()
                       .Where(item => item.Returnkey != null && item.Returnkey != "")
                       .Select(item => item)
                       .ToList();
    

    推荐文章