Sunday, 1 September 2013

Pass QueryOver query as parameter to then execute (nhibernate)

Pass QueryOver query as parameter to then execute (nhibernate)

I have sort of a DOA class where I have my insert, update delete's etc
centralized and I also want to have the QueryOver method there. The method
will create the session etc and All I want to give it from a higher class
is the query.
Logically I would be something like this I guess...
public object QueryOver<T>(IQueryOver query)
{
using (ISession session = SessionManager.OpenSession())
{
return session.QueryOver<T>(???
}
}
Any Ideas? Or this having this 'Ópen session' centralized a bad practice?

No comments:

Post a Comment