NCommet.Modules.Dao is a project that implements IPersister based on NHibernate. It contains the following files:
  • Storage, which implements the IPersister interface of NCommet.
  • The hbm files for the core classes of NCommet that are needed from NHibernate. These are:
    • Item.hbm.xml
    • ContentBase.hbm.xml
    • RelItem.hbm.xml
  • NHibernateSessionManager, which handles the session of NHibernate and the transactions that are made with the database. It also uses the configuration file of the application in order to find the assemblies that contain the hbm files. The keys in the appSettings section of the configuration file are:
    • HBM_ASSEMBLY_COUNT and a value indicating the number of the used assemblies.
    • HBM_ASSEMBLY_* (where * is an integer) and a value with the assembly that contains the hbm files.
  • DaoInterceptor, which implements the interfaces IInterceptor of NHibernate and IDaoEventsSink of NCommet. NHibernate provides access to its events through the IInterceptor interface and that's the role of DaoInterceptor i.e. to subscribe to these events. Such events are the insertion and deletion of items. It then passes these events to IDaoEventsSink. NCommet contains the class EventsSink, which implements the interface IDaoEventsSink and the main purpose is to have a central place where all the events are coming from. This means that the user of NCommet.Core is silently unaware that some of the events are coming directly from NCommet.Core and some other from the persister.
  • CompositeInterceptor, which allows the use of more than one IInterceptor. That's because NHibernate provides support for the use of only one interceptor. NCommet.Modules.Dao uses CompositeInterceptor to add DaoInterceptor to the list of the interceptors it uses.
  • Create.sql, which is an SQL Script that creates all the necessary tables in the database.
  • StorageCleanupModule, is an IHttpModule that helps NHibernateSessionManager close its session and transaction when an HTTP request ends. Should be used with web applications.

Last edited Jun 29, 2010 at 9:16 PM by kingherc, version 4


No comments yet.