持久化类:
public class GLH_Assessment
{
#region 构造函数
public GLH_Assessment() { }
public GLH_Assessment(int number, int departmentID, int staffID, string staffName, string staffNum, string departmentName, int companyScore, int examineScore, string dutiesName, string statusName, DateTime startTime, DateTime endTime, string planContent, int evaluation, int approvedScore, string planDate, string planTopics, decimal appraisalPermissions, decimal sectorRatingPermissions, decimal companyRatingPermissions,string authorizeLevel)
{
this.GLH_number = number;
this.GLH_departmentID = departmentID;
this.GLH_staffID = staffID;
this.GLH_staffName = staffName;
this.GLH_staffNum = staffNum;
this.GLH_departmentName = departmentName;
this.GLH_companyScore = companyScore;
this.GLH_examineScore = examineScore;
this.GLH_dutiesName = dutiesName;
this.GLH_statusName = statusName;
this.GLH_startTime = startTime;
this.GLH_endTime = endTime;
this.GLH_planContent = planContent;
this.GLH_evaluation = evaluation;
this.GLH_approvedScore = approvedScore;
this.GLH_planDate = planDate;
this.GLH_planTopics = planTopics;
this.GLH_appraisalPermissions = appraisalPermissions;
this.GLH_sectorRatingPermissions = sectorRatingPermissions;
this.GLH_companyRatingPermissions = companyRatingPermissions;
this.GLH_authorizeLevel = authorizeLevel;
}
#endregion
#region 成员
private int GLH_number;
private int GLH_departmentID;
private int GLH_staffID;
private string GLH_staffName;
private string GLH_staffNum;
private string GLH_departmentName;
private int GLH_companyScore;
private int GLH_examineScore;
private string GLH_dutiesName;
private string GLH_statusName;
private DateTime GLH_startTime;
private DateTime GLH_endTime;
private string GLH_planContent;
private int GLH_evaluation;
private int GLH_approvedScore;
private string GLH_planDate;
private string GLH_planTopics;
private decimal GLH_appraisalPermissions;
private decimal GLH_sectorRatingPermissions;
private decimal GLH_companyRatingPermissions;
private string GLH_authorizeLevel;
#endregion
#region 属性
public virtual int number
{
get { return GLH_number; }
set { GLH_number = value; }
}
public virtual int departmentID
{
get { return GLH_departmentID; }
set { GLH_departmentID = value; }
}
public virtual int staffID
{
get { return GLH_staffID; }
set { GLH_staffID = value; }
}
public virtual string staffName
{
get { return GLH_staffName; }
set { GLH_staffName = value; }
}
public virtual string staffNum
{
get { return GLH_staffNum; }
set { GLH_staffNum = value; }
}
public virtual string departmentName
{
get { return GLH_departmentName; }
set { GLH_departmentName = value; }
}
public virtual int companyScore
{
get { return GLH_companyScore; }
set { GLH_companyScore = value; }
}
public virtual int examineScore
{
get { return GLH_examineScore; }
set { GLH_examineScore = value; }
}
public virtual string dutiesName
{
get { return GLH_dutiesName; }
set { GLH_dutiesName = value; }
}
public virtual string statusName
{
get { return GLH_statusName; }
set { GLH_statusName = value; }
}
public virtual DateTime startTime
{
get { return GLH_startTime; }
set { GLH_startTime = value; }
}
public virtual DateTime endTime
{
get { return GLH_endTime; }
set { GLH_endTime = value; }
}
public virtual string planContent
{
get { return GLH_planContent; }
set { GLH_planContent = value; }
}
public virtual int evaluation
{
get { return GLH_evaluation; }
set { GLH_evaluation = value; }
}
public virtual int approvedScore
{
get { return GLH_approvedScore; }
set { GLH_approvedScore = value; }
}
public virtual string planDate
{
get { return GLH_planDate; }
set { GLH_planDate = value; }
}
public virtual string planTopics
{
get { return GLH_planTopics; }
set { GLH_planTopics = value; }
}
public virtual decimal appraisalPermissions
{
get { return GLH_appraisalPermissions; }
set { GLH_appraisalPermissions = value; }
}
public virtual decimal sectorRatingPermissions
{
get { return GLH_sectorRatingPermissions; }
set { GLH_sectorRatingPermissions = value; }
}
public virtual decimal companyRatingPermissions
{
get { return GLH_companyRatingPermissions; }
set { GLH_companyRatingPermissions = value; }
}
public virtual string authorizeLevel
{
get { return GLH_authorizeLevel; }
set { GLH_authorizeLevel = value; }
}
#endregion
}
映射:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="MyBookShop.Models" namespace="MyBookShop.Models">
<class name="MyBookShop.Models.GLH_Assessment,MyBookShop.Models" table="Assessment" mutable="false">
<id name="departmentID" column="departmentID" type="Int32">
<generator class="native" />
</id>
<property name="staffName" column="staffName" type="string" />
<property name="staffID" column="staffID" type="int" />
<property name="number" column="number" type="int" />
<property name="staffNum" column="staffNum" type="string" />
<property name="departmentName" column="departmentName" type="string" />
<property name="companyScore" column="companyScore" type="Int32" />
<property name="examineScore" column="examineScore" type="Int32" />
<property name="dutiesName" column="dutiesName" type="string" />
<property name="statusName" column="statusName" type="string" />
<property name="startTime" column="startTime" type="DateTime" />
<property name="endTime" column="endTime" type="DateTime" />
<property name="planContent" column="planContent" type="string" />
<property name="evaluation" column="evaluation" type="Int32" />
<property name="approvedScore" column="approvedScore" type="Int32" />
<property name="planDate" column="planDate" type="string" />
<property name="planTopics" column="planTopics" type="string" />
<property name="appraisalPermissions" column="appraisalPermissions" type="Decimal" />
<property name="sectorRatingPermissions" column="sectorRatingPermissions" type="Decimal" />
<property name="companyRatingPermissions" column="companyRatingPermissions" type="Decimal" />
<property name="authorizeLevel" column="authorizeLevel" type="String" length="1" />
</class>
</hibernate-mapping>
Test:
ISession session = NHHandler.createSession();
ITransaction tran = NHHandler.createTransaction();
ICriteria crite = session.CreateCriteria(typeof(GLH_Assessment));
IList<GLH_Assessment> tmp = crite.List<GLH_Assessment>();
是哪里有错请求指点!为什么查找出来的数据都是一样的啊???????