views:

38

answers:

0

I have 3 classes:

Mail,MailHeader,User

Mail has 2 properties: User and MailHeader

MailHeader has IList of Users (MailsDeleted)

Now i want all mails of a specific user, only if the property MailHeader.MailsDeleted does not contains that user

In other words with Linq i use:

            var q = from sa in candidates
                where  sa.User.Id == _userId
                select sa;
        q = q.Where(sa => !sa.MailHeader.MailsDeleted.Any(x => x.Id == _userId));
        return q;

How can i write this using CreateCriteria? Thanks in advance