Skip to content

corvansteijn/LiquidProjections.NHibernate

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Liquid Projections for NHibernate Build status

What is this?

This package provides an NHibernateProjector that allows you to build NHibernate-backed projectors for use with LiquidProjections' event mapping API and Dispatcher class.

What does it offer?

  • Supports NHibernate 4.0 or later.
  • Allows customizing how many LiquidProjections Transactions it should process in a single database transaction.
  • Supports nesting one or more NHibernateChildProjectors that can be used for maintaining lookup tables and which are part of the same database transaction as the parent projector creates.
  • Ensures autonomy by storing the IProjectionState (e.g. the last transaction checkpoint) in the same transaction as the actual projection data.
  • Exposes the ShouldRetry delegate so that you can handle projection exceptions and get full control on whether or not the projector should retry (again).
  • If the implementation of IProjectorState has additional custom properties, you can use the EnrichState delegate of the NHibernateProjector to update the state object before it is written to the database. This is called as part of the same database transaction that encompasses the projector code.

Caching support

This package provides a simple caching mechanism in the form of the IProjectionCache and ships with the LruProjectionCache based on the FluidCaching project. The IProjectionCache is meant for the most common scenarios and thus has some limitations:

  • If the projector performs database modifications directly on the NHibernate ISession, that projector must make sure the cache is updated or cleared accordingly.
  • The cache doesn't understand relationships where a projection refers to another projection maintained by the same projector. For instance, a projector that maintains a graph of parents and children, where a child is also a (direct or indirect) parent must use a more advanced type of caching.

If you need more advanced caching, please refer to NHibernate's Second Level Caching feature.

How to get started?

Check out the unit tests to learn how the many features work together. You can also look at the non-NHibernate example here and replace Projector with NHibernateProjector. A proper example project for NHibernate is planned.

About

An extension to LiquidProjections that uses NHibernate for storing projections.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • C# 95.7%
  • PowerShell 4.3%