title: HbmSerializer.Default.Serialize - The following assembly contains no mapped classes
body: <p>I am using NHibernate in my web application. So far I have created this following hibernate mapping object class:</p>
  
  <pre><code>namespace Dao {
      /// &lt;summary&gt;
      /// Summary description for User
      /// &lt;/summary&gt;
      public class User {
          private int _id;
  
          public int Id {
              get {
                  return _id;
              }
  
              private set {
                  _id = value;
              }
          }
  
          private string _name;
  
          public string Name {
              get {
                  return _name;
              }
  
              set {
                  _name = value;
              }
          }
  
          public User() {
  
          }
      }
  }
  </code></pre>
  
  <p>The following code:</p>
  
  <pre><code>Configuration configuration = new Configuration();
  configuration.Configure();
  configuration.SetProperty("connection.connection_string", WebConfigurationManager.ConnectionStrings["EMSConnectionString"].ConnectionString);            
  HbmSerializer.Default.Validate = true;
  configuration.AddInputStream(HbmSerializer.Default.Serialize(Assembly.GetExecutingAssembly()));            
  configuration.AddDirectory(new DirectoryInfo(HttpContext.Current.Server.MapPath("~/App_Code/Dao")));
  SessionFactory = configuration.BuildSessionFactory();
  SchemaExport se = new SchemaExport(configuration);
  se.Drop(false, true);
  se.Create(false, true);
  </code></pre>
  
  <p>from the constructor of the class <code>NHibernateModule : IHttpModule</code>.</p>
  
  <p>This is my hbm.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="Dao" assembly="Dao"&gt;
  
  &lt;class name="Dao.User" table="User"&gt;
    &lt;id name="Id" column="Id"&gt;
      &lt;generator class="native"/&gt;
    &lt;/id&gt;
    &lt;property name="Name" column="Name" length="50"/&gt;
  &lt;/class&gt;
  </code></pre>
  
  <p></p>
  
  <p>Now the class <code>User</code> is in Dao folder of App_Code, the hbm.xml resides in the same Dao folder and the class <code>NHibernateModule</code> is in the HttpModules folder of App_Code:</p>
  
  <pre><code>App_Code
  |-------Dao
  |          |---User.cs
  |          |---NHibernateMapping.hbm.xml
  |-------HttpModules
             |---NHibernateModule.cs
  </code></pre>
  
  <p>When I am running the application I am getting:</p>
  
  <pre><code>[MappingException: The following assembly contains no mapped classes: App_Code.qy81yxpd, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]
  NHibernate.Mapping.Attributes.HbmSerializer.Serialize(Stream stream, Assembly assembly) +2855
  NHibernate.Mapping.Attributes.HbmSerializer.Serialize(Assembly assembly) +132
  HttpModules.NHibernateModule..cctor() in e:\EMS\App_Code\HttpModules\NHibernateModule.cs:26
  </code></pre>
  
  <p>Any information will be very helpful to me.</p>
  
  <p>Thanks.</p>