我得到了以下映射
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" auto-import="false">
<subclass name="Module.CRM.Models.CallRecord, Module.CRM" extends="Gate.Calls.CallRecord, Gate.SDK" discriminator-value="call_record_id">
<property name="ContactId" column="contact_id" />
<property name="CompanyId" column="company_id" />
</subclass>
</hibernate-mapping>
和
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" auto-import="false">
<class name="Gate.Calls.CallRecord, Gate.SDK" table="call_records" lazy="true">
<id name="Id" column="id">
<generator class="sequence">
<param name="sequence">call_records_id_seq</param>
</generator>
</id>
<property name="UserId" column="user_id" type="integer" />
<property name="SiteId" column="site_id" type="integer" />
<property name="PhoneNumber" column="phone_number" type="string" />
<property name="CreatedAt" column="created_at" type="datetime" />
<property name="Duration" column="duration" type="integer" />
<property name="IsInbound" column="is_inbound" type="boolean" />
<property name="HangupCause" column="hangup_cause" type="integer" />
<property name="RingDuration" column="ring_duration" type="integer" />
</class>
</hibernate-mapping>
我收到以下错误
找不到Module.CRM.Models.CallRecord的鉴别器。
我没有指定鉴别器吗?
修改
做了更多的研究:鉴别家不是我应该使用的。 crm_call_records中的call_record_id指向call_records中的id。映射文件应该是什么样的?
答案 0 :(得分:1)
您需要在CallRecord映射中添加一个鉴别器。即
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" auto-import="false">
<class name="Gate.Calls.CallRecord, Gate.SDK" table="call_records" lazy="true">
<id name="Id" column="id">
<generator class="sequence">
<param name="sequence">call_records_id_seq</param>
</generator>
</id>
<discriminator column="Discriminator"
not-null="true"
type="System.String"/>
<property name="UserId" column="user_id" type="integer" />
<property name="SiteId" column="site_id" type="integer" />
<property name="PhoneNumber" column="phone_number" type="string" />
<property name="CreatedAt" column="created_at" type="datetime" />
<property name="Duration" column="duration" type="integer" />
<property name="IsInbound" column="is_inbound" type="boolean" />
<property name="HangupCause" column="hangup_cause" type="integer" />
<property name="RingDuration" column="ring_duration" type="integer" />
</class>
的示例