N2, NHibernate and multiple databases

Topics: Developer Forum
Apr 1, 2009 at 7:06 PM

We're following the N2CMS MVC example in our own .Net MVC project and everything was going well until we tried to access some data from another custom database repository. We want to split out our custom database for our domain as its nothing to do with N2 and we need to seperate the N2 content DB from our domain model DB in order to be able to scale our DB layer outwards. N2 uses NHibernate, and our custom domain layer also uses NHibernate to access data from its repository. 

If we configure our app to point to our own nHib configuration file, then N2 blows up, as it no longer can connect to the N2 DB. Can someone help us out with this - has anyone else tackled this issue? I've found some information on using NHibernate with multiple databases, using mulitple SessionFactories, but if anyone's got an example of how to do this with N2 that would help us out massively. Even better if it's an MVC example!

Apr 1, 2009 at 9:51 PM
N2 wraps up it's own instance of the session factory so you should be able to do this. Could it be that your configuration section is picked up by N2's nhibernate configuration class? Can you post a stack trace detailing the explosion?