FluentNHibernate: multiple one-to-many relationships between the same entities.
- by Venemo
Hi,
I'm working on a bug tracking application. There are tickets, and each ticket has an opener user and an assigned user. So, basically, I have two entities, which have two many-to-one relationships with each other. Their schematic is this:
User:
public class User
{
public virtual int Id { get; private set; }
...
public virtual IList<Ticket> OpenedTickets { get; set; }
public virtual IList<Ticket> AssignedTickets { get; set; }
}
Ticket:
public class Ticket
{
public virtual int Id { get; protected set; }
...
[Required]
public virtual User OpenerUser { get; set; }
public virtual User AssignedUser { get; set; }
}
I use FluentNHibernate's auto mapping feature.
The problem is, that no matter whether relationship I set, on the side of the User, both collections always contain the same data. I guess Fluent can't tell which end of which relationship belongs to where.
I googled around but haven't found anything useful.
Could anyone help me, please?