title: How to stop Fluently.Configure connecting automatically
body: <p>How can I prever Fluently.Configure connection to the DB automatically?</p>
  
  <p>Our setup is detailed below.</p>
  
  <p>We have the following static method to create a session factory:</p>
  
  <pre><code>public static ISessionFactory CreateSessionFactory()
          {
            return Fluently.Configure()
                .Database(
                   IfxOdbcConfiguration
                  .Informix
                  .ConnectionString("DSN=ODBCCONNECTION")
                  .Driver&lt;CompanyCore.Nhibernate.Core.ProfiledODBCClientDriver&gt;()
                  .Dialect&lt;InformixDialect1000&gt;()
                  .ShowSql() 
                )
                .Mappings(
                m =&gt; m.FluentMappings.AddFromAssemblyOf&lt;Task&gt;()
                )
                .BuildSessionFactory();
          }
  </code></pre>
  
  <p>Which is used with our IOC setup to create the SessionFactory, however, due to what is required by our DB team, each user must open his/her own connections as their user (Using impersonalisation) - to allow for process identification, to see who is running what on the Informix server.</p>
  
  <p>To create the individual connections we use:</p>
  
  <pre><code>public static ISession GetMySession(ISessionFactory factory, string user)
  {
      CompanyCore.Nhibernate.Core.ProfiledODBCClientDriver drv = new Enact.Nhibernate.Core.ProfiledODBCClientDriver();
  
      drv.Configure(new Dictionary&lt;string, string&gt;());
  
      string conn = "DSN=ODBCCONNECTION";
  
      IDbConnection db = drv.CreateConnection();
  
      db.ConnectionString = conn;
      db.Open();
  
      return factory.OpenSession(db);
  }
  </code></pre>
  
  <p>These connections are closed when our UOW calls dispose.</p>
  
  <p>We call <code>CreateSessionFactory()</code> on APP Start and then pass this factory around with IOC, but at this point there is no impersonalisation user, and thus causes a app error on first load.</p>
  
  <p>We have thought about using a standard user which has access for things like first load, but surely there is a better way?</p>