简体   繁体   中英

Maintain Table History with Nhibernate

I have a situation where I have to maintain History of a table.

For Eg: I have PaymentTransaction Table and I want to keep PaymentTransactionHistory for auditing purposes.

Do we have anything in NHIbernate that can be used to achieve this. I read about IInterceptor and Events and couldn't really understand if they could be of any use in my case.

I am using Fluent NHIbernate.

Many Thanks

NHibernate Envers也可能是您的选择-但可能对您提到的用法有些过高

In my project this is done by an interceptor, using following methods:

  • When something got deleted, process it in OnDelete
  • When something inserted into DB, process it in OnSave
  • When something changes, process it in OnFlushDirty
  • There are some other methods for handling collection.

Just try them, it's not difficult.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM