0

我对这种情况感到困惑。有这两个类:

public class Payment {
    public Payment() { }
    public  string Trn { get; set; }
    public  TxType TxTypeId { get; set; }
    public  string TxCode { get; set; }        
    public  System.Nullable<decimal> Amount { get; set; }
    public  System.Nullable<System.DateTime> DateStamp { get; set; } }


public PaymentAudit() { }
    public  System.DateTime DateStamp { get; set; }
    public  Payment Trn { get; set; }
    public  PaymentSaga PaymentStateId { get; set; }
    public  ProcessState ProcessState { get; set; }
    public  PublishState PublishState { get; set; }
    public  System.Nullable<short> ChgCount { get; set; }
    public  string UserName { get; set; }

映射是:

  <class name="Payment" table="Payment" lazy="false" >
    <id name="Trn">
      <generator class="identity" />
    </id>
    <many-to-one insert="false" update="false" lazy="false" name="TxTypeId">
      <column name="TxTypeId" sql-type="varchar" not-null="false" />
    </many-to-one>
    <property name="TxTypeId">
      <column name="TxTypeId" sql-type="varchar" not-null="false" />
    </property>
    <many-to-one insert="false" update="false" lazy="false" name="TxCode">
      <column name="TxCode" sql-type="varchar" not-null="false" />
    </many-to-one>
    <property name="TxCode">
      <column name="TxCode" sql-type="varchar" not-null="false" />
    </property>
    <property name="Amount">
      <column name="Amount" sql-type="decimal" not-null="false" />
    </property>
    <property name="DateStamp">
      <column name="DateStamp" sql-type="datetime" not-null="false" />
    </property>   
    <bag name="PaymentAudits" inverse="true" cascade="none">
      <key column="Trn" />
      <one-to-many class="PaymentAudit" not-found="ignore" />
    </bag>  
  </class>


  <class name="PaymentAudit" table="PaymentAudit" >
    <composite-id>
      <key-many-to-one name="PaymentStateId"  column="PaymentStateId" />
      <key-property name="DateStamp" column="DateStamp" />
      <key-many-to-one name="ProcessState" column="ProcessState" />
    </composite-id>
    <property name="PublishState">
      <column name="PublishState" sql-type="varchar" not-null="false" />
    </property>
    <many-to-one  name="Trn">
      <column name="Trn" sql-type="varchar" not-null="false" />
    </many-to-one>
    <property name="ChgCount">
      <column name="ChgCount" sql-type="smallint" not-null="false" />
    </property>
    <property name="UserName">
      <column name="UserName" sql-type="nvarchar" not-null="false" />
    </property>
    <many-to-one  name="PublishState">
      <column name="PublishState" sql-type="varchar" not-null="false" />
    </many-to-one> 
  </class>

桌子,

付款:
Trn PK
TxTypeId FK
TxCode FK
Amount
DateStamp

PaymentAudit:
PaymentStateId PK DateStamp
PK
ProcessState PK
PublishState FK
Trn FK
ChgCount
用户名

我得到了这个错误: 无法确定类型:MyProject.NHibernate.Payment.Model.Payment.Payment,MyProject.NHibernate.Payment.Model,Version=1.0.0.0,Culture=neutral,PublicKeyToken=null,对于列:NHibernate .Mapping.Column(Trn)

有任何想法吗?谢谢。

4

1 回答 1

1

Trn 是主键,是一个字符串并且被映射为身份?Identity 是一个整数,所以属性应该是 int。

于 2012-06-28T09:32:20.913 回答