public class Card
{
public int CardId { get; set; }
public string DesignType { get; set; }
public int Size { get; set; }
}
public class Employee
{
public int EmpId { get; set; }
public string Name { get; set; }
public IList<Card> lstOfCards { get; set; }
}
Mappers:CARD hbm.xml
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="ORLibrary" namespace="ORLibrary.Domain" >
<class name="Card" table="dbo.Cards" lazy="false">
<id name="CardId" type="int">
</id>
<property name="DesignType" />
<property name="Size" />
对于员工:
<id name="EmpId" type="int"> </id>
<property name="Name" />
<bag name="lstOfCards" table="Emp_Cards" >
<key column="EmpId" />
<many-to-many class="Domain.Card" column="CardId" />
</bag>
现在每次我通过opensession()创建一个Isession对象引用时,它会抛出异常An association from the table Emp_Cards refers to an unmapped class: Domain.Card