Hi Nabil,

I think the following would work:

int entityId;
Type entityType;
...
var documents =
   session.QueryOver<Document>()
       .Where(d => d.GetType() == entityType)
       .And(d => d.Id == entityId)
       .List();

Regards,
   Richard

-----Original Message----- From: nabils
Sent: Sunday, March 20, 2011 10:11 PM
To: nhusers
Subject: [nhusers] QueryOver with id and class special properties (for "any" type queries)

I have the below hql query which I am trying to convert to be more
strongly typed. My first option would be QueryOver, failing that
criteria api would be fine. I have tried both with no luck. Please can
someone convert? Thanks
Nabil

var documents = session.CreateQuery(@"
                              from Document d
                               where d.Entity.class = :entityType
                               and d.Entity.id = :entityId")
                   .SetString("entityType", entityType)
                   .SetInt32("entityId", entityId)
                   .List<Document>();

--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.

--
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to