4
我有一個Mailclass,我想將發件人和收件人保存爲User類的引用;nHibernate,將兩個屬性映射到同一個類
public class dbMail : Entity
{
public virtual int ThreadID { get; set; }
public virtual dbUser From { get; set; }
public virtual dbUser To { get; set; }
public virtual DateTime MailDate { get; set; }
public virtual string MailText { get; set; }
public virtual bool IsRead { get; set; }
}
和映射:
<id name="ID">
<generator class="identity" />
</id>
<property name="ThreadID" />
<many-to-one name="From" class="dbUser" column="From"/>
<many-to-one name="To" class="dbUser" column="To"/>
<property name="MailDate" />
<property name="MailText" type="StringClob">
<column name="MailText" sql-type="text" />
</property>
<property name="IsRead" />
但是,試圖更新數據庫時,會出現此錯誤:
Duplicate property mapping of dbUser found in Domain.Model.dbMail
這工作!感謝你及時的答覆。 – rodael
此外,單詞「收件人」和「發件人」保留。 – rodael