我将 NHibernate 3.2 与 MS SQL Server 2008 R2 一起使用
我有休闲映射
<class name="LocalizedProperty" table="LocalizedProperty">
<cache usage="read-write"/>
<id name="Id" column="Id">
<generator class="guid.comb"/>
</id>
<property name="CultureName" not-null="true"/>
<property name="PropertyName" not-null="true"/>
<property name="PropertyValue" not-null="true"/>
<any id-type="Guid" name="Entity">
<column name="LocalizedEntityClass" not-null="true"/>
<column name="EntityId" not-null="true"/>
</any>
</class>
这个有一个对 LocalizedProperty 的引用:
<class name="CommunicationType" table="CommunicationType" lazy="false" >
...
<set name="LocalizedProperties" where="LocalizedEntityClass = 'Prayon.Entities.CommunicationType'" cascade="delete">
<key column="EntityId" foreign-key="none" />
<one-to-many class="LocalizedProperty" />
</set>
</class>
我的问题是,当我删除 CommunicationType 的实体时,NHibernate 正在执行 LocalizedProperty 的休闲更新语句
UPDATE LocalizedProperty SET EntityId = null WHERE EntityId = @p0 AND (LocalizedEntityClass = 'Prayon.Entities.CommunicationType')
而不是删除语句。
有人看到了吗,怎么了?