app.config文件内容 
<?xml version="1.0" encoding="utf-8" ?> 
<configuration>   <runtime> 
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">       <probing privatePath="Nhibernate;Service"/>     </assemblyBinding> 
  </runtime> 
  
</configuration> 
nhibernate.access.cfg.xml配置文件内容: <?xml version="1.0" encoding="utf-8" ?> 
<hibernate-configuration  xmlns="urn:nhibernate-configuration-2.2" > 
  
  <session-factory xmlns="urn:nhibernate-configuration-2.2"> 
    <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider </property> 
    <property name="connection.driver_class">NHibernate.JetDriver.JetDriver, NHibernate.JetDriver </property> 
    <property name="dialect">NHibernate.JetDriver.JetDialect, NHibernate.JetDriver </property> 
    <property name="connection.connection_string">Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\TestApplication\ApplicationTest\bin\Db\TestAccess.mdb </property> 
    <property name="show_sql">false </property> 
    <property name="use_outer_join">true </property> 
    <property name="use_proxy_validator">false </property> 
  </session-factory> 
</hibernate-configuration> 
程序启动,链接数据库正常,但是通过codesmith添加代码出现标题上的错误 程序初始化代码:       private void NhibernateInit() 
        {            
            Configuration config = new Configuration(); 
            config.SetNamingStrategy(new Access.NamingStrategy()); 
            config.Configure(Application.StartupPath + @"\nhibernate.access.cfg.xml"); 
            config.AddAssembly("GJBase");                    // 这句话报错,如标题 
            //config.AddAssembly("SysUiManageLib"); 
            //config.AddAssembly("CustomServer"); 
            //config.AddAssembly("GoodsServer"); 
            //config.AddAssembly("PrivilageServer");             _sessionFactory = config.BuildSessionFactory(); 
        } 我添加的 映射类 c# 和  hbm.xml(是内嵌的, C#类属性是virtual的 
c#代码: 
using System; 
using System.Collections; 
using System.DirectoryServices; namespace MyNamespace.Data 

#region GJCustom /// <summary> 
/// GJCustom object for NHibernate mapped table 'GJ_Custom'. 
/// </summary> 
public class GJCustom : System.IComparable 

#region Member Variables protected int _id; 
protected string _cAddress; 
protected string _cemail; 
protected short _cID; 
protected string _cName; 
protected string _cPhone; 
protected static String _sortExpression = "Id"; 
protected static SortDirection _sortDirection = SortDirection.Ascending; #endregion #region Constructors public GJCustom() { } public GJCustom( string cAddress, string cemail, short cID, string cName, string cPhone ) 

this._cAddress = cAddress; 
this._cemail = cemail; 
this._cID = cID; 
this._cName = cName; 
this._cPhone = cPhone; 
} #endregion #region Public Properties public virtual int Id 

get {return _id;} 
set {_id = value;} 
} public virtual string CAddress 

get { return _cAddress; } 
set 

if ( value != null && value.Length > 50) 
throw new ArgumentOutOfRangeException("Invalid value for CAddress", value, value.ToString()); 
_cAddress = value; 

} public virtual string Cemail 

get { return _cemail; } 
set 

if ( value != null && value.Length > 50) 
throw new ArgumentOutOfRangeException("Invalid value for Cemail", value, value.ToString()); 
_cemail = value; 

} public virtual short CID 

get { return _cID; } 
set { _cID = value; } 
} public virtual string CName 

get { return _cName; } 
set 

if ( value != null && value.Length > 50) 
throw new ArgumentOutOfRangeException("Invalid value for CName", value, value.ToString()); 
_cName = value; 

} public virtual string CPhone 

get { return _cPhone; } 
set 

if ( value != null && value.Length > 50) 
throw new ArgumentOutOfRangeException("Invalid value for CPhone", value, value.ToString()); 
_cPhone = value; 

}         public static String SortExpression 
        { 
            get { return _sortExpression; } 
            set { _sortExpression = value; } 
        }         public static SortDirection SortDirection 
        { 
            get { return _sortDirection; } 
            set { _sortDirection = value; } 
        } 
#endregion         #region IComparable Methods 
        public int CompareTo(object obj) 
        { 
if (!(obj is GJCustom)) 
throw new InvalidCastException("This object is not of type GJCustom"); int relativeValue; 
switch (SortExpression) 

case "Id": 
relativeValue = this.Id.CompareTo(((GJCustom)obj).Id); 
break; 
case "CAddress": 
relativeValue = (this.CAddress != null) ? this.CAddress.CompareTo(((GJCustom)obj).CAddress) : -1; 
break; 
case "Cemail": 
relativeValue = (this.Cemail != null) ? this.Cemail.CompareTo(((GJCustom)obj).Cemail) : -1; 
break; 
case "CID": 
relativeValue = (this.CID != null) ? this.CID.CompareTo(((GJCustom)obj).CID) : -1; 
break; 
case "CName": 
relativeValue = this.CName.CompareTo(((GJCustom)obj).CName); 
break; 
case "CPhone": 
relativeValue = (this.CPhone != null) ? this.CPhone.CompareTo(((GJCustom)obj).CPhone) : -1; 
break; 
                default: 
                    goto case "Id"; 

            if (GJCustom.SortDirection == SortDirection.Ascending) 
relativeValue *= -1; 
return relativeValue; 

#endregion 
} #endregion 

hbm.xml配置: <?xml version="1.0" encoding="utf-8" ?> 
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"> 
<class name="MyNamespace.Data.GJCustom, MyApp.MyAssembly" table="GJ_Custom"> 
<id name="Id" type="Int32" unsaved-value="0"> 
<column name="NumberId" sql-type="adInteger" not-null="true" unique="true" index="PrimaryKey"/> 
<generator class="native" /> 
</id> 
<property name="CAddress" type="String"> 
<column name="CAddress" length="50" sql-type="adVarWChar" not-null="false"/> 
</property> 
<property name="Cemail" type="String"> 
<column name="Cemail" length="50" sql-type="adVarWChar" not-null="false"/> 
</property> 
<property name="CID" type="Int16"> 
<column name="CID" sql-type="adSmallInt" not-null="false" index="ID"/> 
</property> 
<property name="CName" type="String"> 
<column name="CName" length="50" sql-type="adVarWChar" not-null="true"/> 
</property> 
<property name="CPhone" type="String"> 
<column name="CPhone" length="50" sql-type="adVarWChar" not-null="false"/> 
</property> 
</class> 
</hibernate-mapping>