Search code examples
c#nhibernatequeryover

Nhibernate Queryover Case Insensitive IsIn


I've got this example code...

Result = session.QueryOver<Lfee_Exc>().WhereRestrictionOn(x => x.FirstName)
.IsIn(ListOfFirstNames).List();

Is there any way to make this case insenstive or upper case x.ArNumber for my case sensitive Oracle server?


Solution

  • Convert ListOfFirstNames to upercase and then:

    session.QueryOver<Lfee_Exc>()
        .Where(Restrictions.In(Projections.SqlFunction(
                                  "upper", NHibernateUtil.String,
                                   Projections.Property<Lfee_Exc>(x => x.FirstName)),
                               ListOfFirstNames))