【问题标题】:Creating an "In" Restriction with Linq to NHibernate使用 Linq to NHibernate 创建“In”限制
【发布时间】:2011-01-11 18:15:49
【问题描述】:

任何人都知道我如何使用 Linq to NHibernate 创建“In”限制。

即生成类似的SQL

选择 p.Name 来自人 p where p.City In ('London', 'New York', 'Auckland')

谢谢。

【问题讨论】:

    标签: linq nhibernate


    【解决方案1】:

    好的,我解决了这个问题。 可以做到:

    from p in session.Query<Person> where cities.Contains(p.City) select p

    其中城市是一组城市名称

    有人知道 Linq to NHibernate 示例的好参考吗?

    【讨论】:

    • 也试试from p in session.Query&lt;Person&gt; where cities.Any(p.City) select p
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-09-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多