尝试在基类中设置 ForeignKeyAttribute 时出错
class User { }
abstract class FruitBase
{
[ForeignKey("CreateById")]
public User CreateBy{ get; set; }
public int CreateById{ get; set; }
}
class Banana : FruitBase { }
class DataContext : DbContext
{
public DbSet<Banana> Bananas { get; set; }
}
如果我将 FruitBase 代码移动到香蕉中,一切都很好,但我不想这样做,因为会有很多水果,如果可以的话,我想保持相对干燥
这是一个将在 3 月之前解决的已知问题吗?有谁知道解决方法?