title: How to configure NHibernate SessionFactory in code
body: <p>I'm new to NHibernate and I'm trying to configure it based on the book 'Learning NHibernate 4'. However, I'm stuck with how to configure it. I have a class called <code>Connection</code> but when I try to use it, NHibernate tells me it can't find 'HbmMapping'.</p>
  
  <pre><code>class Connection
      {
          public Connection() 
          {
              var cfg = new Configuration();
              cfg.DataBaseIntegration(x =&gt;
              {
                  x.Dialect&lt;PostgreSQLDialect&gt;();
                  x.Driver&lt;NpgsqlDriver&gt;();
                  x.ConnectionString = "Server=127.0.0.1; Port=5433; User Id=smartwarehouse; Password=$smart#2018;Database=warehouse;";
                  x.ConnectionReleaseMode = ConnectionReleaseMode.OnClose;
                  x.LogSqlInConsole = true;
                  x.LogFormattedSql = true;
  
  
              }).AddMapping(GetMappings());
  
          }
            // here is Hbm dosn't find from library
       private HbmMapping GetMappings() 
          {
  
  
  
          }
      }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/6rAHH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6rAHH.png" alt="enter image description here"></a></p>
  
  <p>it gives me other two options to use like here</p>
  
  <p><a href="https://i.stack.imgur.com/rz0Ky.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rz0Ky.png" alt="enter image description here"></a></p>