假设我在下面的实体中定义了一个表公司:
public class Company
{
public Guid CompanyId { get; set; }
[Required]
public string Name { get; set; }
[MaxLength(50)]
public string Uid { get; set; }
...
}
我需要另一张表CompanyHistory将公司的所有领域扩展到CompanyHistoryId,EffectiveDate,DEffectiveDate。 我试过这样的话:
public class CompanyHistory : Company
{
public Guid CompanyHistoryId { get; set; }
public virtual Company { get; set; }
}
但是,而不是2个表,迁移会生成一个并组合所有列。
如果不按照此处的说明重新编写所有列,我如何获得相同的结果:
public class CompanyHistory
{
public Guid CompanyHistoryId { get; set; }
public Guid CompanyId { get; set; }
public virtual Company Company { get; set; }
[Required]
public string Name { get; set; }
[MaxLength(50)]
public string Uid { get; set; }
...
}