How to do a NotEqual to in NHibernate

Posted by Blankman on Stack Overflow See other posts from Stack Overflow or by Blankman
Published on 2010-04-25T21:49:45Z Indexed on 2010/04/25 21:53 UTC
Read the original article Hit count: 234

Filed under:
|

I have an enumeration of type int in my entity, UserStatus.

I want to get all users where the UserStatus <> Cancelled.

So:

Session.CreateCriteria(typeof(User))
.Add(Expression.Eq("UserStatus", (int)UserStatus.Cancelled)
.UniqueResult<User>();

The above is fore equal, I need to get not equal.

© Stack Overflow or respective owner

Related posts about c#

Related posts about nhibernate