Are Denormalized Updates Possible With NHibernate Without Using a Stored Procedure?

大城市里の小女人 提交于 2019-12-04 19:18:54

Yes, you can register an event listener inheriting from DefaultSaveOrUpdateEventListener, override OnSaveOrUpdate and update the other entities.

Here are some blog posts about event listeners:

Some thoughts on de-normalised data:

  • Use sparingly; excessive use of denormalised data is known to be a source of maintenance and data quality problems down the track. One J2EE project I was involved in had just 4 denormalised data items in 560 tables - two of those items were search tables.

  • Relying on an application to keep de-normalised data in sync is a known anti-pattern. The generally accepted way to maintain de-normalised data in a transactional system is to use database triggers. Using triggers means that an update from any source (not just your application) will be propogated by the database itself. You would be better off using triggers to maintain the denormalised data unless something specific prevents it.

  • Denormalised data leaves elephant traps for maintenance developers (especially if you don't use DB triggers to maintain the data). Make sure each and every piece of denormalised data is documented.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!