Hi guys, 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
System.InvalidCastException: Unable to cast object of type 'x' to type 'Iesi.Collections.ISet'
Does anybody knows the solution.
<class name="Customer" table="Customers" lazy="false" dynamic-update="true">
<id name="Id" column="CustomerID" type="Guid" >
<generator class="guid.comb" />
</id>
<property name="Name" column="CustomerName" type="String" length="50" not-null="true" />
<bag name="users" table="Users" cascade="all-delete-orphan">
<key column="CustomerID" />
<one-to-many class="User" />
</bag>
<set name="customerPreferences" table="Preferences" cascade="all-delete-orphan">
<key column="CustomerID" />
<one-to-many class="CustomerPreferences" />
</set>
</class>
Entity class: public class Customer { private Guid _id; private string _name; private IList _users = new List(); private CustomerPreferences _customerPreferences;
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<User> Users
{
get { return _users; }
set { _users = value; }
}