NHibernate.Linq LIKE

前端 未结 4 1317
眼角桃花
眼角桃花 2021-02-12 10:02

How can I produce this query using NHibernate.Linq?

WHERE this_.Name LIKE @p0; @p0 = \'test\'  // Notice NO % wild card

Note, this is not Linq

4条回答
  •  [愿得一人]
    2021-02-12 10:33

    Whilst this has been marked as resolved, which was correct at the time, may I also note that NHibernate has some extensions now so you can do the following:

    Session.QueryOver()
        .Where(x => x.Property.IsLike("something", MatchMode.Anywhere))
        .List();
    

    This will do a LIKE '%something%' for you.

提交回复
热议问题