I am trying to build a simple query in nHibernate with QueryOver but I want it to convert everything lower-case or ignore sensitive:
Domain.User User = Session.QueryOver<Domain.User>()
.Where(x=>x.Login=="username")
.SingleOrDefault();
How can I achieve this?
UPDATE:
Someone suggested that the problem could be with the colletion of the DB but I've never had any kind of problem with that and this script works:
Domain.User User = Session
.CreateCriteria<Domain.User>()
.Add(Expression.Eq("Login", "username"))
.UniqueResult<Domain.User>();
In QueryOver you can use following:
Domain.User User = Session.QueryOver<Domain.User>()
.WhereRestrictionOn(x=>x.Login).IsInsensitiveLike("username")
.SingleOrDefault();