源码如下 
using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Xml.Linq;
using System.Collections;
using System.Collections.Generic;namespace ReadingRoom.Entity
{
#region ResourceCategory /// <summary>
/// NHibernate 的对象 ResourceCategory 映射到表 'Resource_Category'.
/// </summary>
public class ResourceCategory 
{
#region 成员变量

protected string _id;
protected int _rcSortID;
protected string _rcName;
protected string _rcIcon;
protected int _rcCount;
protected string _rcMemo;
protected ResourceCategory _rcParent;
protected IList _rcParentResourceCategories; #endregion #region 构造函数 public ResourceCategory() { }        public ResourceCategory(int rcSortID, string rcName, string rcIcon, int rcCount, string rcMemo, ResourceCategory rcParent)
        {
            this._rcSortID = rcSortID;
            this._rcName = rcName;
            this._rcIcon = rcIcon;
            this._rcCount = rcCount;
            this._rcMemo = rcMemo;
            this._rcParent = rcParent;
        } #endregion #region 公共属性 /// <summary>
        /// 分类标识_rcID
        /// </summary>
public virtual string Id
{
get {return _id;}
set
{
if ( value != null && value.Length > 50)
throw new ArgumentOutOfRangeException("赋给 Id 的是无效值", value, value.ToString());
_id = value;
}
}        /// <summary>
        /// 序号_rcSortID
        /// </summary>
public virtual int RcSortID
{
get { return _rcSortID; }
set { _rcSortID = value; }
}        /// <summary>
        /// 分类名_rcName
        /// </summary>
public virtual string RcName
{
get { return _rcName; }
set
{
if ( value != null && value.Length > 50)
throw new ArgumentOutOfRangeException("赋给 RcName 的是无效值", value, value.ToString());
_rcName = value;
}
}        /// <summary>
        /// 图标_rcIcon
        /// </summary>
public virtual string RcIcon
{
get { return _rcIcon; }
set
{
if ( value != null && value.Length > 255)
throw new ArgumentOutOfRangeException("赋给 RcIcon 的是无效值", value, value.ToString());
_rcIcon = value;
}
}        /// <summary>
        /// 资源数_rcCount
        /// </summary>
public virtual int RcCount
{
get { return _rcCount; }
set { _rcCount = value; }
}        /// <summary>
        /// 备注_rcMemo
        /// </summary>
public virtual string RcMemo
{
get { return _rcMemo; }
set
{
if ( value != null && value.Length > 1000)
throw new ArgumentOutOfRangeException("赋给 RcMemo 的是无效值", value, value.ToString());
_rcMemo = value;
}
}
/// <summary>
        /// 
        /// </summary>
public virtual ResourceCategory rcParent
{
get { return _rcParent; }
set { _rcParent = value; }
} /// <summary>
        /// 
        /// </summary>
public virtual IList rcParentResource_Categories
{
get { return _rcParentResourceCategories; }
set { _rcParentResourceCategories = value; }
} #endregion

} #endregion
}
配置文件如下 <?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="ReadingRoom.Entity.ResourceCategory, ReadingRoom.Entity" table="Resource_Category">
<id name="Id" type="String" unsaved-value="null">
<column name="rcID" length="50" sql-type="varchar" not-null="true" unique="true" index="PK_RESOURCE_CATEGORY"/>
<generator class="native" />
</id>
<property name="RcSortID" type="Int32">
<column name="rcSortID" length="4" sql-type="int" not-null="false"/>
</property>
<property name="RcName" type="String">
<column name="rcName" length="50" sql-type="nvarchar" not-null="false"/>
</property>
<property name="RcIcon" type="String">
<column name="rcIcon" length="255" sql-type="varchar" not-null="false"/>
</property>
<property name="RcCount" type="Int32">
<column name="rcCount" length="4" sql-type="int" not-null="false"/>
</property>
<property name="RcMemo" type="String">
<column name="rcMemo" length="1000" sql-type="nvarchar" not-null="false"/>
</property>
<many-to-one name="rcParent" class="ReadingRoom.Entity.ResourceCategory, ReadingRoom.Entity">
<column name="rcParentID" length="50" sql-type="varchar" not-null="false"/>
</many-to-one>
  </class>
</hibernate-mapping>
添加的时候总是报错,说rcID不能为空,我是菜鸟,求高手指点~
ResourceCategory rcEntity = new ResourceCategory();
                rcEntity.Id = System.Guid.NewGuid().ToString();
                rcEntity.RcName = Validation.SQLFilter(txtName.Text.Trim());
                rcEntity.RcMemo = Validation.SQLFilter(txtMemo.Text.Trim());
                rcEntity.RcSortID = TypeParse.StrToInt(txtSortID.Text.Trim(), 0);
                if (ResourceManager.CreateCategory(rcEntity))
                {
                    JsHelper.AlertAndRedirect("添加成功", "addcategory.aspx?id=" + rcID, this.Page);
                }
                else
                {
                    JsHelper.Alert("添加失败", this.Page);
                }