Configure NHibernate With Embedded Resource[source]

    <title>Configure NHibernate With Embedded Resource</title>
    <description>How to configure NHibernate for a test assembly circa 2010</description>
<glacius:macro name="legacy blargh banner">
  I spent a couple dozen minutes figuring this out today. There are several different ways to 
  configure NHibernate:
      The default way, which is having a <code>hibernate-section</code> configuration section in 
      your app.config, or having a <code>hibernate.cfg.xml</code> in the root of your app.
  <li>Embedded resource</li>
  <li>Hard-coded path to config file</li>
  In my app, I have some tests that spin up a database and test out some NHibernate-related 
  stuff, like that things cascade properly. So that means I needed a <code>hibernate.cfg.xml</code>
  file for my test assembly as well. And that sucked, because I didn't want to put it at the root 
  of the application because it cluttered up the directory and I have a disorder regarding stuff 
  like that.
  So, I left the <code>hibernate.cfg.xml</code> file in my non-root directory, and turned it 
  into an embedded resource.
<glacius:figure glacius:src="hibernate-config-properties.png">
    <caption>hibernate.cfg.xml properties config</caption>
  Now you have to figure out the manifest resource name of this embedded resource, which is just
  the path to the file on disk.
<glacius:code lang="csharp"><![CDATA[
// assuming this class and hibernate.cfg.xml reside in the same directory
new NHibernate.Cfg.Configuration().Configure(
<p>And then you profit.</p>