I'm trying to create a simple User object that has a Friends property that points to an IList.
Started off just trying to get an ISet to work.
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-lazy="false"
assembly="MyProject.Domain" namespace="MyProject.Domain">
<class name="User" table="[User]">
<id name="Id" column="UserId">
<generator class="increment" />
</id>
<property name="UserName" column="UserName" />
<property name="Location" />
<set name="Friends" table="Friend" lazy="false">
<key column="UserId" />
<many-to-many class="User" column="FriendId" />
</set>
</class>
</hibernate-mapping>
This seems to be working ok. But how would I convert this to a IList and maybe sort the Friends by the date the relationship was established (in reverse chronological order) Can I add a "sort by" field to the Friend table?
Here is my class so far -
public class User
{
public virtual int Id { get; set; }
public virtual string UserName { get; set; }
public virtual string Location { get; set; }
public virtual ISet<User> Friends { get; set; }
}