How can i add some sql to all querys in NHibernate
I want a version control system and therefore all querys must add a piece of sql
In place for the current record 开发者_Go百科shows.
But what place, can i add that piece of sql to all querys ? or could i do it with events?
Make a class that implements IInterceptor
then give that class as param to the session like
SessionManager.SessionFactory.OpenSession(new newClass()));
in the class you need to give your implementation to
public NHibernate.SqlCommand.SqlString OnPrepareStatement(NHibernate.SqlCommand.SqlString sql)
{
}
each query that will run on this session will be intercept here and there you can add some sql
精彩评论