I have an application that uses NHibrenate and I'm using an interceptor based solution for logging/auditing.
Basically I have a class inheriting from EmptyInterceptor and overriding OnFlushDirty, OnSave and OnDelete.
Everything works perfectly - except - when I add or remove from a set or list that is mapped using many-to-many without changing any other properties none of the interceptor methods are called.
How can I hook into NHibrenate and detect those changes?
The class looks like:
public class SomeClass
{
... properties ..
private Iesi.Collections.ISet _setOfOthers = new Iesi.Collections.HashedSet();
public virtual Iesi.Collections.ISet SetOfOthers
{
get { return _setOfOthers; }
set { _setOfOthers = value; }
}
... some more properties ...
}
With this hbm mapping:
<class name="MyAssembly.SomeClass, MyAssembly" table="[SomeClass]">
... properties ..
<set name="SetOfOthers" table="SomeClass_SetOfOthers" cascade="none">
<key column="Owner" />
<many-to-many column="Item" class="MyAssembly.OtherClass, MyAssembly" />
</set>
.. some more properties ...
</class>
I'm using NHibrenate 2.0.1 (if that makes any difference), this is not a good time in the project life cycle to upgrade NHibrenate - but I will upgrade if I absolutely have to.
Thanks.