tags:

views:

71

answers:

1

I want a version control system and therefore all querys must add a piece of sql

In place for the current record shows.

But what place, can i add that piece of sql to all querys ? or could i do it with events?

+1  A: 

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

Marco