Student stu = new Student() { Name = "lisi" };
IList<Student> list = _session.CreateCriteria(typeof(Student))
.Add(Example.Create(stu))
.List<Student>();
数据库里的数据:
数据表结构:
我查看了一下NHibernate生产的SQL语句,为:
SELECT this_.id as id0_0_, this_.name as name0_0_, this_.sex as sex0_0_, this_.age as age0_0_ FROM people this_
WHERE (this_.name = ? and this_.age = ?)