public void Install(IIocContainer container) { var connectionString = ApplicationConfig.Configuration.GetConnectionString(SettingKeys.MainConnectionString) ?? throw new ArgumentException("Connection string not found"); var cfg = new Configuration() .DataBaseIntegration(db => { db.ConnectionString = connectionString; db.Dialect <MsSql2008Dialect>(); db.Driver <SqlClientDriver>(); db.ConnectionProvider <DriverConnectionProvider>(); db.BatchSize = 5000; db.Timeout = byte.MaxValue; //db.LogFormattedSql = true; //db.LogSqlInConsole = true; }) .AddAssembly(typeof(NHibernateDao).Assembly); var sessionFactory = cfg.BuildSessionFactory(); container.AddInstance(cfg); container.AddInstance(sessionFactory); }