nhibernateconfigurationfluent-nhibernate

How to get NHibernate Configuration from ISessionFactory


Is there any way to get Configuration details from instance of ISessionFactory in NHibernate?


Solution

  • the ISessionFactory doesn't expose the configuration that was used to create the session factory, and I'm not sure the concrete implementation does either.

    However, why don't you consider injecting the configuration to? Maybe you are not using dependency injection, if you do, just register it into the kernel.

    Otherwise, consider using a wrapper class that keeps both the configuration and the ISessionFactory.