Note that there are some explanatory texts on larger screens.

plurals
  1. POInvalidcastexception error while using set or bag cascading
    text
    copied!<p>I have a parent class which contains a child object. I am using set to save the child object when parent is saved. I m not sure whether set is used for just saving a child object. And im getting this error below</p> <p>System.InvalidCastException: Unable to cast object of type 'x' to type 'Iesi.Collections.ISet'</p> <p>Does anybody knows the solution.</p> <p> </p> <pre><code>&lt;class name="Customer" table="Customers" lazy="false" dynamic-update="true"&gt; &lt;id name="Id" column="CustomerID" type="Guid" &gt; &lt;generator class="guid.comb" /&gt; &lt;/id&gt; &lt;property name="Name" column="CustomerName" type="String" length="50" not-null="true" /&gt; &lt;bag name="users" table="Users" cascade="all-delete-orphan"&gt; &lt;key column="CustomerID" /&gt; &lt;one-to-many class="User" /&gt; &lt;/bag&gt; &lt;set name="customerPreferences" table="Preferences" cascade="all-delete-orphan"&gt; &lt;key column="CustomerID" /&gt; &lt;one-to-many class="CustomerPreferences" /&gt; &lt;/set&gt; &lt;/class&gt; </code></pre> <p></p> <p>Entity class: public class Customer { private Guid _id; private string _name; private IList _users = new List(); private CustomerPreferences _customerPreferences;</p> <pre><code> public Guid Id { get { return _id; } set { _id = value; } } public string Name { get { return _name; } set { _name = value; } } public CustomerPreferences CustomerPreferences { get { return _customerPreferences; } set { _customerPreferences = value; } } public IList&lt;User&gt; Users { get { return _users; } set { _users = value; } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload