I am working on a bug tracking application. There are tickets, and each ticket has an open user and a designated user. So basically, I have two entities that have two βone or twoβ relationships with each other. They are schematically:
User:
public class User
{
public virtual int Id { get; protected set; }
...
public virtual IList<Ticket> OpenedTickets { get; set; }
public virtual IList<Ticket> AssignedTickets { get; set; }
}
tickets:
public class Ticket
{
public virtual int Id { get; protected set; }
...
[Required]
public virtual User OpenerUser { get; set; }
public virtual User AssignedUser { get; set; }
}
I am using the FluentNHibernate auto-matching feature.
The problem is that regardless of whether the connection is established, on the user side, both collections always contain the same data. I guess Fluent cannot determine which end of the relationship refers to where.
I googled around but didn't find anything useful.
EDIT 2:
, IHasManyConvention. , IHasManyConvention , IReferenceConvention. .
, ForeignKey.EndsWith("Id") .
, , , .