目前我使用提取條件數據多到一個在HBM文件元素像下面....NHibernate的 - 如何從數據庫中使用HBM文件映射
<property name="ContactId" length="4" />
<many-to-one
name="DefaultContact"
column="ContactId"
class="Models.Contact"
update="false"
insert="false"/>
獲取從數據庫中的數據對象
此代碼是正確的獲取數據,但現在我需要獲取有條件像我有以下特性和HBM文件MANT-to-one元素的數據.....
<property name="ParentId" length="4" />
<property name="ParentType" length="4" />
<many-to-one
name="ContactParent"
column="???????? ParentId which could be CustomerId or ProspectId or LeadId according to Parent Type ????????"
class="???????? Models.Customer or Models.Prospect or Models.Lead - according to Parent Type ????????"
update="false"
insert="false"/>
而且我有根據「父類型」中的值獲取數據pe「屬性,這意味着我需要根據」父類型「 屬性動態地設置」多對一「元素的類屬性。
所以現在,我該如何用多對一的元素或其他方式達到預期的效果......?
在此先感謝。