You can use SetProperties () for the configuration object at runtime, and then create a SessionFactory from this configuration. SetProperties uses the dictionary as a parameter. Then the new SessionFactory will use the new configuration options.
IDictionary<string, string> props = new Dictionary<string, string>(); props["show_sql"] = "true"; Configuration config = new NHibernate.Cfg.Configuration(); config.SetProperties(props); config.Configure(); config.AddAssembly(typeof(User).Assembly); ISessionFactory factory = config.BuildSessionFactory();
See this section of the documentation for more information: ISessionFactory Configuration
Hope this helps.
/ Erik
source share