Login

Username

Password





Register   Reset password

Developer resources

Developer documents

Developer articles

Dynamic modules and O/R mapping with NHibernate

One of the more challenging things of O/R mapping is how to handle modules that are dynamically loaded (especially when they are in different assemblies). The core engine of the website doesn't know which modules are going to be loaded so it can only initialize the mapping of it's own domain classes.

Cuyahoga handles this by providing a central facility (a Singleton wrapper around NHibernate's SessionFactory) where modules can register their domain classes. When registering, a check is being performed if the class is already mapped. If not, the classes are added to the mapping configuration and the SessionFactory is rebuilt. The caller recieves a notification that the SessionFactory is rebuilt and stops executing. The browser is then redirected to the same url whereafter page execution starts again, but now with the mapping information in place and nicely integrated with the mapping information of the core domain classes.

1/5/2005 10:42:00 PM Published by Martijn Boland Category Developers Comments 1

Comments
  • About the NHibernate HTTP Module, why not put session handling in CoreRepositry as well? that way, u may use your CoreRepositry not just over web, but you may use it on, for example, windows app as well.

    by C.W. Chan - 8/5/2005 4:52:28 AM

Back