所以我有一个包含 ContactCardGroupMemberships 集合的 ContactCardGroup 类:
public class ContactCardGroup : AbstractEntity, IContactCardGroup
{
public ICollection<ContactCardGroupMembership> Members { get; protected set; }
还有一个 ContactCardGroupMembership 类:
public class ContactCardGroupMembership : AbstractAspect
{
public long MembershipId { get; set; }
public long GroupId { get; set; }
public ContactCard Contact { get; set; }
public bool IsPrimary { get; set; }
public ICollection<ContactGroupRole> Roles { get; protected set; }
public ContactCardGroupMembership()
{
this.Roles = new Collection<ContactGroupRole>();
}
}
因此,在整个代码中,如果我有一个 ContactCardGroup 成员而不是 GroupId,这将是有帮助的……但这不是引入讨厌的循环引用,尤其是在处置/销毁方面。这些事情有规则/模式吗?
似乎自从我安装了 ReSharper 以来,我对我所做的任何编码选择都不再有任何信心;(