我不知道它是否与abp有关但是,我可能会相信社区中的某些人可以帮助我。
我有以下用户和部门实体。用户实体确实带有abp默认值。这很简单,我指定了导航。但代码首先为我生成了这个愚蠢的数据库。表中有两个用户ID,这使得很难在项目中跟踪它。为什么会这样,以及如何避免?
public class User : AbpUser<User>
{
public virtual ICollection<UserDepartment> UserDepartments { get; set; }
}
public class Department : FullAuditedEntity<int, User>
{
public virtual ICollection<UserDepartment> UserDepartments { get; set; }
}
public class UserDepartment : FullAuditedEntity<int, User>
{
public virtual long UserId { get; set; }
[ForeignKey("DepartmentId")]
public virtual Department Department { get; set; }
public virtual int DepartmentId { get; set; }
[ForeignKey("UserId")]
public virtual User User { get; set; }
}