public object Invoke(IMethodInvocation invocation) { //anything special for equals/hashcode? if (invocation.Method.Name.Equals("Close")) { return(null); } else { object retValue = invocation.Proceed(); if (retValue is IQuery) { hibernateAccessor.PrepareQuery((IQuery)retValue); } if (retValue is ICriteria) { hibernateAccessor.PrepareCriteria((ICriteria)retValue); } return(retValue); } }