(N)Hibernate : Search against 2 fields at once

In my project, I have a Member class with:

public virtual string FirstName;
public virtual string LastName;

I'm familiar with using Criteria and Disjunctions to search against the columns individually, but how can I set things up so that "Davie Jones" will return the people with first name Davie and last name Jones (or vice versa) ?


如果您使用的是QueryOver 3.0,则可以使用QueryOver

IEnumerable<Member> matchingMembers = iSession.QueryOver<Member>()
                                              .Where(m => m.FirstName == firstName)
                                              .And(m => m.LastName == lastName)
                                              .List<Member>();
链接地址: http://www.djcxy.com/p/6322.html

上一篇: Hibernate Criteria按集合的属性过滤

下一篇: (N)Hibernate:一次搜索2个字段