title: NHibernate: How to solve this "dialect" configuration issue
body: <p><strong>Problem Encountered</strong></p>
  
  <p>At runtime, I always get the following <code>NHibernate.MappingException</code>:</p>
  
  <pre><code>"Could not compile the mapping document: GI.InventoryManager.CYB.Mappings.Part.hbm.xml"
  </code></pre>
  
  <p>Yes, its build action is set to <code>Embedded Resource</code>. The InnerException says:</p>
  
  <pre><code>"Could not find the dialect in the configuration"
  </code></pre>
  
  <p><strong>Required Information</strong></p>
  
  <p>Here is my configuration file named <code>hibernate.cfg.xml</code>:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;hibernate-configuration  xmlns="urn:nhibernate-configuration-2.2" &gt;
    &lt;session-factory&gt;
      &lt;property name="connection.driver_class"&gt;NHibernate.Driver.SqlClientDriver&lt;/property&gt;
      &lt;property name="connection.connection_string"&gt;
          Server=(local);initial catalog=GI_IM_CYB;Integrated Security=SSPI
      &lt;/property&gt;
      &lt;property name="adonet.batch_size"&gt;10&lt;/property&gt;
      &lt;property name="show_sql"&gt;false&lt;/property&gt;
      &lt;property name="dialect"&gt;NHibernate.Dialect.MsSql2005Dialect&lt;/property&gt;
      &lt;property name="use_outer_join"&gt;true&lt;/property&gt;
      &lt;property name="command_timeout"&gt;60&lt;/property&gt;
      &lt;property name="query.substitutions"&gt;true 1, false 0, yes 'Y', no 'N'&lt;/property&gt;
      &lt;property name="proxyfactory.factory_class"&gt;NHibernate.ByteCode.Castle.ProxyFactoryFactory,     NHibernate.ByteCode.Castle&lt;/property&gt;
    &lt;/session-factory&gt;
  &lt;/hibernate-configuration&gt;
  </code></pre>
  
  <p>Which actually is a copy-paste from the <em>Configuration_Templates</em> folder in which I only changed the following information:</p>
  
  <pre><code>Session Factory: "Removed the NHibernate.Test namespace and let the property for itself"
  Dialect: "From MsSql2000Dialect To MsSql2005Dialect"
  Connection_String: "I changed the Initial Catalog attribute to input my own database name"
  Factory Class: "From LinFu to Castle"
  </code></pre>
  
  <p>And here's how I'm using it in my code:</p>
  
  <pre><code>private void configBackgroundWorker_DoWork(object sender, DoWorkEventArgs e) {
      Configuration c = new Configuration();
      c.AddAssembly(typeof(Part).Assembly);
      lock (_sessionFactory) {
          _sessionFactory = c.BuildSessionFactory();
      }
  }
  </code></pre>
  
  <p><strong>Optional Information</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" auto-import="true" assembly="GI.InventoryManager.CYB" namespace="GI.InventoryManager.CYB.Types"&gt;
    &lt;class name="Part" table="Parts" lazy="true"&gt;
      &lt;id name="Id" column="part_id"&gt;
        &lt;generator class="native"/&gt;
      &lt;/id&gt;
      &lt;properties name="Description"/&gt;
      &lt;properties name="Number"/&gt;
      &lt;properties name="InStockQty"/&gt;
      &lt;properties name="Cost"/&gt;
    &lt;/class&gt;
  &lt;/hibernate-mapping&gt;
  
  
  public class Part {
      #region Private Members
  
      private string _description;
      private string _number;
  
      #endregion
      #region Constructors
  
      /// &lt;summary&gt;
      /// Initializes an instance of the GI.InventoryManager.CYB.Types.Part class.
      /// &lt;/summary&gt;
      public Part() { }
  
      #endregion
      #region Properties
  
      /// &lt;summary&gt;
      /// Gets or sets the description of this part.
      /// &lt;/summary&gt;
      public virtual string Description {
          get {
              return _description;
          } set {
              if (!string.IsNullOrWhiteSpace(value))
                  _description = value.Trim();
          }
      }
  
      /// &lt;summary&gt;
      /// Gets the underlying datastore unique identifier.
      /// &lt;/summary&gt;
      public virtual int Id { get; private set; }
  
      /// &lt;summary&gt;
      /// Gets or sets the user-defined number.
      /// &lt;/summary&gt;
      public virtual string Number {
          get {
              return _number;
          } set {
              if (!string.IsNullOrWhiteSpace(value))
                  _number = value.Trim();
          }
      }
  
      /// &lt;summary&gt;
      /// Gets or sets the in-stock quantity.
      /// &lt;/summary&gt;
      public virtual int InStockQty { get; set; }
  
      /// &lt;summary&gt;
      /// Gets or sets the cost.
      /// &lt;/summary&gt;
      public virtual double? Cost { get; set; }
  
      /// &lt;summary&gt;
      /// Gets the inventory value for this part.
      /// &lt;/summary&gt;
      /// &lt;remarks&gt;
      /// &lt;para&gt;
      /// This read-only property returns the product of &lt;see cref="T:InStockQty"/&gt; and &lt;see   cref="Cost"/&gt;. 
      /// In case the &lt;b&gt;Cost&lt;/b&gt; property does not have a value, zero is returned.
      /// &lt;/para&gt;
      /// &lt;/remarks&gt;
      public double InventoryValue {
          get {
              if (Cost.HasValue)
                  return InStockQty * Cost.Value;
              return 0.0;
          }
      }
  
      #endregion
      #region Methods
  
  
  
      #endregion
  }
  </code></pre>
  
  <p><strong>Environment</strong> </p>
  
  <ol>
  <li>Windows 7 Pro;</li>
  <li>Visual Studio 2010, targeting .NET 4.0;</li>
  <li>NHibernate 3.0.0.GA;</li>
  <li>SQL Server 2005.</li>
  </ol>
  
  <p><strong>Question</strong></p>
  
  <p>I have already tried to put the dialect property on the line of the configuration, and it neither worked.</p>
  
  <p>How to solve this dialect problem that I have?</p>