NHibernate - QBE and EnableLike ()
I have a problem using QBE with NHibernate.
Here's some sample code:
Person person = new Person();
person.FirstName = "e";
using (ISession session = SessionFactory.CreateSession())
{
Example example = Example.Create(person).ExcludeProperty("DateOfBirth").EnableLike().IgnoreCase();
IList<Person> people = session.CreateCriteria<Person>().Add(example).List<Person>();
return people;
}
I expect this example and criteria to return all individuals whose name begins with the letter "e". BUT, for this I had to insert an escape character in the example property of the object. Like this:
person.FirstName = "e%";
With this modification, the query returns the desired results. Should "EnableLike" take care of this?
What am I doing wrong?
Thank!
+2
source to share
1 answer