title: Fluent Mapping and NHibernate Xml Configuration
body: <p>I have an application using NHibernate and I'm using Fluent NHibernate to mapping my entities. It works fine, but, I want to create the SessionFactory using the native way of NHibernate because my team will ues this library on other projects, so we need this flexibilty to move the nhibernate.cfg.xml. My question is: <em>How can I set the Fluent Mappings in the configuration of SessionFactory with native way of nhibernate?</em></p>
  
  <p>I try something like this on my configuration method:</p>
  
  <pre><code>private static ISessionFactory Configure()
  {
      if (_factory != null)
          return _factory;
  
      var configuration = new Configuration().Configure();
  
          // I could set my assembly of mapping here, but it's on our internal framework
      var fluentConfiguration = Fluently.Configure(configuration)
          //.Mappings(c =&gt; c.FluentMappings.AddFromAssembly(typeof(ProductMap)))
          .BuildConfiguration();
  
      _factory = fluentConfiguration.BuildSessionFactory();
  
      return _factory;
  }
  </code></pre>
  
  <p>I tried to set it by xml, but it does not work.</p>
  
  <pre><code>&lt;hibernate-configuration xmlns="urn:nhibernate-configuration-2.2"&gt;
      &lt;session-factory&gt;     
          &lt;!-- other configs here...--&gt;     
          &lt;mapping assembly="MyApplication.Data.Mapping" /&gt;
      &lt;/session-factory&gt;
  &lt;/hibernate-configuration&gt;
  </code></pre>
  
  <p>I don't know if is there any way to get this mapping setted on the xml and pass to <code>FluentConfiguration</code> declaration on my method to create the <code>ISessionFactory</code>.</p>
  
  <p>Thank you guys.</p>