i'm not having a bidirectional relation between my parent (Condition) and child (ConditionWord) and i'm having problems deleting childs out of my IList<ConditionWord>
Adding is not an issue. if i add a ConditionWords to my list, it will be saved in the ConditionWord table.
I can also get them out of the database with getting the Condition. The ConditionWords will be filled in.
BUT if i try to clear the list (condition.Words.Clear()) it's telling me that the IList is Read-only, and i cannot delete anything. the IList is declared by NHibernate as an Array.
Any idea why that's happening? (using NHibernate 2.0)
Condition class (parent)
Code:
<bag name="Words" cascade="all-delete-orphan">
<key column="ConditionID"/>
<one-to-many class="ConditionWord"/>
</bag>
Code:
private IList<ConditionWord> words = new List<ConditionWord>();
public IList<ConditionWord> Words
{
get { return words; }
set { words = value; }
}
ConditionWord class (child)
Code:
<class xmlns="urn:nhibernate-mapping-2.2" name="ConditionWord" schema="dbo" table="ConditionWords" dynamic-update ="true">
<id name="Id" access="field.camelcase" unsaved-value="0">
<column name="ID" sql-type="int" not-null="true" unique="true"/>
<generator class="native"></generator>
</id>
...