如何在不删除引用对象的情况下删除Nhibernate多对多关联

如何在不删除引用对象的情况下删除Nhibernate多对多关联,nhibernate,many-to-many,associations,Nhibernate,Many To Many,Associations,大家好 <property name="Name" column="[SiteGroupName]"/> <many-to-one name="ClientInfo" column="[ClientID]"/> <set name="internalSites" table="SiteGroupSites" cascade="none" inverse="true"> <key column="[SiteGroupID]"/> <

大家好

<property name="Name" column="[SiteGroupName]"/>

<many-to-one name="ClientInfo" column="[ClientID]"/>

<set name="internalSites" table="SiteGroupSites" cascade="none" inverse="true">
  <key column="[SiteGroupID]"/>
  <many-to-many class="Site" column="SiteID"/>
</set>

<set name="internalSiteGroups" table="SiteGroupGroups" cascade="none" inverse="true">
  <key column="[SiteGroupID]"/>
  <many-to-many class="SiteGroup" column="ChildSiteGroupID"/>
</set>
如果不删除NHibernate中的对象,我在删除两个对象之间的关联时遇到问题。我的映射文件:

<?xml version="1.0" encoding="utf-8" ?>
<property name="Name" column="[SiteGroupName]"/>

<many-to-one name="ClientInfo" column="[ClientID]"/>

<set name="internalSites" table="SiteGroupSites" cascade="none" inverse="true">
  <key column="[SiteGroupID]"/>
  <many-to-many class="Site" column="SiteID"/>
</set>

<set name="internalSiteGroups" table="SiteGroupGroups" cascade="none" inverse="true">
  <key column="[SiteGroupID]"/>
  <many-to-many class="SiteGroup" column="ChildSiteGroupID"/>
</set>
我不明白的是,当我保存时,它会删除关联和实际站点。我是不是误解了什么?我想要的是网站从网站组中删除,而不是完全删除

<property name="Name" column="[SiteGroupName]"/>

<many-to-one name="ClientInfo" column="[ClientID]"/>

<set name="internalSites" table="SiteGroupSites" cascade="none" inverse="true">
  <key column="[SiteGroupID]"/>
  <many-to-many class="Site" column="SiteID"/>
</set>

<set name="internalSiteGroups" table="SiteGroupGroups" cascade="none" inverse="true">
  <key column="[SiteGroupID]"/>
  <many-to-many class="SiteGroup" column="ChildSiteGroupID"/>
</set>
我们将非常感谢您的帮助。

您觉得如何

<property name="Name" column="[SiteGroupName]"/>

<many-to-one name="ClientInfo" column="[ClientID]"/>

<set name="internalSites" table="SiteGroupSites" cascade="none" inverse="true">
  <key column="[SiteGroupID]"/>
  <many-to-many class="Site" column="SiteID"/>
</set>

<set name="internalSiteGroups" table="SiteGroupGroups" cascade="none" inverse="true">
  <key column="[SiteGroupID]"/>
  <many-to-many class="SiteGroup" column="ChildSiteGroupID"/>
</set>
site.Sitegroup=null;
//保存

你解决问题了吗?
<property name="Name" column="[SiteGroupName]"/>

<many-to-one name="ClientInfo" column="[ClientID]"/>

<set name="internalSites" table="SiteGroupSites" cascade="none" inverse="true">
  <key column="[SiteGroupID]"/>
  <many-to-many class="Site" column="SiteID"/>
</set>

<set name="internalSiteGroups" table="SiteGroupGroups" cascade="none" inverse="true">
  <key column="[SiteGroupID]"/>
  <many-to-many class="SiteGroup" column="ChildSiteGroupID"/>
</set>