我有一个类,我想在数据库中创建一个表
namespace WCG.Data.EntityObjects
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;
/// <summary>
/// Class to access FaxHistory Table
/// </summary>
public class FaxHistory
{
public virtual int Id { get; set; }
// public virtual bool display { get; set; }
public virtual bool IsDeleted { get; set; }
[Required(ErrorMessage = "Fax History Date is required.")]
[Display(Name = "Fax History Date")]
public virtual DateTime FaxHistDate { get; set; }
[Required(ErrorMessage = "Fax History to Text is required.")]
[Display(Name = "Fax History To Text")]
public virtual string FaxHistToText {get;set;}
[Required(ErrorMessage = "Fax History NumText is required.")]
[Display(Name = "Fax History NumText")]
public virtual string FaxHistNumText {get;set;}
[Required(ErrorMessage = "Fax History From Text is required.")]
[Display(Name = "Fax History From Text")]
public virtual string FaxHistFromText {get;set;}
[Required(ErrorMessage = "Fax History ReText is required.")]
[Display(Name = "Fax History ReText")]
public virtual string FaxHistREText{get;set;}
[Required(ErrorMessage = "Fax History CmtText is required.")]
[Display(Name = "Fax History CmtText")]
public virtual string FaxHistCmntText { get; set; }
[Required(ErrorMessage = "Fax History Filename is required.")]
[Display(Name = "Fax History Filename")]
public virtual string FaxHistFilenameText { get; set;}
public virtual DateTime DateCreated { get; set; }
public virtual DateTime DateModified { get; set; }
public virtual string CreatedBy { get; set; }
public virtual string ModifiedBy { get; set; }
}
}
NHibernate映射文件是FaxHistory.hbm.xml
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="Data" namespace="WCG.Data.EntityObjects">
<class name="FaxHistory" table="FaxHistory">
<id name="Id" column="Id" type="System.Int32">
<generator class="identity" />
</id>
<property name="FaxHistDate" column="FaxHistDate" type="System.DateTime" />
<property name="FaxHistToText" column="FaxHistToText" type="System.String" insert="true" update="true"/>
<property name="FaxHistNumText" column="FaxHistNumText" type="System.String" insert="true" update="true"/>
<property name="FaxHistFromText" column="FaxHistFromText" type="System.String" insert="true" update="true"/>
<property name="FaxHistREText" column="FaxHistREText" type="System.String" insert="true" update="true"/>
<property name="FaxHistCmntText" column="FaxHistCmntText" type="System.String" insert="true" update="true"/>
<property name="FaxHistFilenameText" column="FaxHistFilenameText" type="System.String" insert="true" update="true"/>
<property name="DateCreated" column="DateCreated" type="System.DateTime" insert="true" update="false"/>
<property name="DateModified" column="DateModified" type="System.DateTime" insert="true" update="true"/>
<property name="CreatedBy" column="CreatedBy" type="System.String" insert="true" update="false"/>
<property name="ModifiedBy" column="ModifiedBy" type="System.String" insert="true" update="true"/>
<property name="IsDeleted" column="IsDeleted" type="System.Boolean" />
</class>
</hibernate-mapping>
但是当我尝试在表单的帮助下将某些数据添加或更新到表中时,我收到错误
No persister for: WCG.Data.EntityObjects.FaxHistory
看过很多关于这个主题的讨论,但由于我不熟悉NHibernate
,所以无法得到任何帮助。