title: NHibernate.MappingException: No persister No mapped documents found in assembly
body: <p>I have been doing nhibernate since many days. But Today I stuck at a frustrating issue i.e. mapping exception.</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="IPC.Base.Domains" assembly="IPC"&gt;
    &lt;class name="MenuItem" table="dbo.COR_MenuItem" default-access="property" default-cascade="save-update" default-lazy="true"&gt;
      &lt;cache usage="read-only" region="completelyStatic"/&gt;
      &lt;id name="Id" type="System.Int32"&gt;
        &lt;generator class="identity" /&gt;
      &lt;/id&gt;
      &lt;property name="Name" type="System.String" /&gt;
      &lt;property name="Order" column="DisplayOrder" /&gt;
      &lt;property name="Key" column="KeyChain" /&gt;
      &lt;property name="Route" /&gt;
      &lt;property name="ActionMethod" /&gt;
      &lt;property name="IsHotlink" /&gt;
      &lt;many-to-one name="ParentMenuItem" column="ParentMenuItemId" class="MenuItem" cascade="none"/&gt;
      &lt;bag name="MenuItems" table="dbo.COR_MenuItem" cascade="none"&gt;
        &lt;cache usage="read-only" region="completelyStatic"/&gt;
        &lt;key column="ParentMenuItemId" /&gt;
        &lt;one-to-many class="MenuItem" /&gt;
      &lt;/bag&gt;
    &lt;/class&gt;
  &lt;/hibernate-mapping&gt;
  </code></pre>
  
  <p>And I do have a mapping class as following:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  
  namespace IPC.Base.Domain
  {
      public partial class MenuItem : PersistentObject
      {
          public MenuItem()
          {
              MenuItems = new List&lt;MenuItem&gt;();
          }
          public virtual string Name { get; set; }
          public virtual int? Order { get; set; }
          public virtual string Key { get; set; }
          public virtual string Route { get; set; }
          public virtual string ActionMethod { get; set; }
          public virtual bool IsHotlink { get; set; }
          public virtual IList&lt;MenuItem&gt; MenuItems { get; set; }
          public virtual MenuItem ParentMenuItem { get; set; }
  
          /// &lt;summary&gt;
          /// only to be used from the menu builder app
          /// &lt;/summary&gt;
          /// &lt;param name="id"&gt;&lt;/param&gt;
          public virtual void SetId(int id)
          {
              Id = id;
          }
      }
  }
  </code></pre>
  
  <p>I have the following nHibernate Config running with the application. But as per my experience there is absolutely no issue with the nHibernate Config.</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;hibernate-configuration xmlns="urn:nhibernate-configuration-2.2"&gt;
   &lt;session-factory name="IPC"&gt;
    &lt;property name="dialect"&gt;NHibernate.Dialect.MsSql2005Dialect&lt;/property&gt;
      &lt;property name="connection.driver_class"&gt;NHibernate.Driver.SqlClientDriver&lt;/property&gt;
      &lt;property name="connection.connection_string"&gt;**************SQL CONNECTION****************/property&gt;
      &lt;property name="proxyfactory.factory_class"&gt;NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu&lt;/property&gt;
      &lt;property name="cache.provider_class"&gt;NHibernate.Caches.SysCache.SysCacheProvider, NHibernate.Caches.SysCache&lt;/property&gt;
    &lt;property name="cache.use_query_cache"&gt;true&lt;/property&gt;
      &lt;property name="show_sql"&gt;true&lt;/property&gt;
      &lt;mapping assembly="IPC"/&gt;
   &lt;/session-factory&gt;
  &lt;/hibernate-configuration&gt;
  </code></pre>
  
  <p>I am using the following line for code for invoking nHibernate session object to system. </p>
  
  <pre><code>static ISessionFactory CurrentFactory
          {
              get
              {
                  if (factory == null)
                  {
                      Configuration cfg = new Configuration();
                      if (cfgFile == null)
                          cfg = cfg.Configure();
                      else
                          cfg = cfg.Configure(cfgFile);
  
                      factory = cfg.BuildSessionFactory();
                  }
                  return factory;
              }
          }
          public static ISession Create()
          {
              var session = CurrentFactory.OpenSession();
              return session;
          }
  </code></pre>
  
  <p>Now! When I call the following line of code I am getting:</p>
  
  <pre><code>public virtual T Get(int id)
          {
              return Session.Get&lt;T&gt;(id);
          }
  
  
  No persister for: IPC.Base.Domain.MenuItem
  Exception Details: NHibernate.MappingException: No persister for: IPC.Base.Domain.MenuItem
  </code></pre>
  
  <p>I have already enabled by nHibernate log. Following are the basic details from log</p>
  
  <pre><code>00:54:40.011 [4] INFO  NHibernate.Cfg.Environment - NHibernate 2.1.0.4000 (2.1.0.4000)
  00:54:40.055 [4] INFO  NHibernate.Cfg.Environment - Bytecode provider name : lcg
  00:54:40.057 [4] INFO  NHibernate.Cfg.Environment - Using reflection optimizer
  00:54:40.682 [4] DEBUG NHibernate.Cfg.Configuration - dialect=NHibernate.Dialect.MsSql2005Dialect
  00:54:40.683 [4] DEBUG NHibernate.Cfg.Configuration - connection.driver_class=NHibernate.Driver.SqlClientDriver
  00:54:40.683 [4] DEBUG NHibernate.Cfg.Configuration - connection.connection_string=*********************SQL Connection*****************
  00:54:40.683 [4] DEBUG NHibernate.Cfg.Configuration - proxyfactory.factory_class=NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu
  00:54:40.683 [4] DEBUG NHibernate.Cfg.Configuration - cache.provider_class=NHibernate.Caches.SysCache.SysCacheProvider, NHibernate.Caches.SysCache
  00:54:40.683 [4] DEBUG NHibernate.Cfg.Configuration - cache.use_query_cache=true
  00:54:40.683 [4] DEBUG NHibernate.Cfg.Configuration - show_sql=true
  00:54:40.684 [4] DEBUG NHibernate.Cfg.Configuration - IPC&lt;-IPC
  00:54:40.685 [4] INFO  NHibernate.Cfg.Configuration - Searching for mapped documents in assembly: IPC
  00:54:40.689 [4] WARN  NHibernate.Cfg.Configuration - No mapped documents found in assembly: IPC, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
  00:54:40.691 [4] INFO  NHibernate.Cfg.Configuration - Configured SessionFactory: IPC
  00:54:40.691 [4] DEBUG NHibernate.Cfg.Configuration - properties: System.Collections.Generic.Dictionary`2[System.String,System.String]
  00:54:45.716 [4] INFO  NHibernate.Cfg.Configuration - checking mappings queue
  00:54:45.716 [4] INFO  NHibernate.Cfg.Configuration - processing one-to-many association mappings
  00:54:45.717 [4] INFO  NHibernate.Cfg.Configuration - processing one-to-one association property references
  00:54:45.717 [4] INFO  NHibernate.Cfg.Configuration - processing foreign key constraints
  00:54:45.747 [4] INFO  NHibernate.Dialect.Dialect - Using dialect: NHibernate.Dialect.MsSql2005Dialect
  </code></pre>
  
  <p>I have read almost all the post with stack! :) and even doing google for the same. The final words I am getting there is an issue with my assembly naming! I sure that there is a issue with the steps which I have followed. But still searching for that trigger!!! </p>
  
  <p>Thanks! 
  In advance!!</p>