日期:2014-05-16 浏览次数:20573 次
public class HiberInterceptor : EmptyInterceptor网上查改资料,得知使拦截器生效有如下两种方法:
{
public override bool OnSave(object entity, object id, object[] state, string[] propertyNames, NHibernate.Type.IType[] types)
{
string aa = "执行中";
return true;
}
public override NHibernate.SqlCommand.SqlString OnPrepareStatement(NHibernate.SqlCommand.SqlString sql)
{
return base.OnPrepareStatement(sql);
}
}
session = sessionFactory.OpenSession(new MyInterceptor());
new Configuration().SetInterceptor(new MyInterceptor());