title: How to generate hbm.xml file from FluentNHibernate
body: <p>I'm trying to follow this <a href="http://www.dotnetguy.co.uk/post/2009/10/19/using-fluent-Nhibernate-to-Export-Create-hbm-files-(Nhibernate-mapping-files).aspx" rel="noreferrer">tutorial</a> but instead of generating the expected hbm.xml files with my mappings in it generates simple .cs class for my entities like for example:</p>
  
  <pre><code>public class ProductMap : ClassMap&lt;Product&gt;
  </code></pre>
  
  <p>But I already defined those myself in code. I'm after the .hbm.xml which I can use in standard NHibernate at this time.</p>
  
  <p>This is how I set up the SessionFactory:</p>
  
  <pre><code>    private static ISessionFactory CreateSessionFactory()
      {
          String schemaExportPath = Path.Combine(System.Environment.CurrentDirectory, "Mappings");
  
          if (!Directory.Exists(schemaExportPath))
              Directory.CreateDirectory(schemaExportPath);
  
  
          return Fluently.Configure()
              .Database(MsSqlConfiguration.MsSql2008
                  .ConnectionString(c =&gt;c.FromConnectionStringWithKey("connectionString"))
                  .Cache(c =&gt; c.UseQueryCache()
                      .ProviderClass&lt;HashtableCacheProvider&gt;()).ShowSql())
              .Mappings(m =&gt; m.FluentMappings.AddFromAssemblyOf&lt;Program&gt;().ExportTo(schemaExportPath))
              .ExposeConfiguration(c =&gt; new SchemaExport(c).SetOutputFile(@"c:\temp\test.sql").Create(false, true))
              .BuildSessionFactory();
      }
  </code></pre>