I have been trying to do a very simple auditing scenario following Ayende's blog which seem to be the resource everyone is refering to when it comes to IPreUpdateEventListener and IPreInsertEventListener.
However no matter how hard I tried, I couldn't get it to work. The event fired correctly, everything looked ok when I stepped through it but no update of my "changedtime" was ever issued to the database.
I spent about a day googling this and finally found the answer here.
It just won't work when you have your entity mapped with dynamic-update="true". And sure enough, that was the case for me. Since it was so hard for me to find this piece of information, is it uncommon to use dynamic-update="true"? We use it on all our entities.
As this is a major bump in the road for us I wanted to ask if there's any way around this at all?
I have been looking at IInterceptor but it's always refered to as outdated, so what's the drawbacks with this? Also I haven't been able to find a really good tutorial on how to archieve the same auditing (with insert/update timestamps) with IInterceptor (I'm fairly new to NHibernate).
Any help would be appreciated!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…