我有以下模型,我想在数据库ShiftRequest
中MissionRequest
有一个表。
public class RequestBase
{
public int Id { get; set; }
public DateTime? RequestDate { get; set; }
public int UserId { get; set; }
public virtual ICollection<Notification> Notifications { get; set; }
}
public class ShiftRequest : RequestBase
{
public virtual Column Column { get; set; }
}
public class MissionRequest : RequestBase
{
public virtual Mission Mission { get; set; }
}
我尝试在该override void OnModelCreating(ModelBuilder modelBuilder)
方法中执行此操作,但只RequestBases
创建了一个表:
modelBuilder.Entity<ShiftRequest>().MapSingleType().ToTable("dbo.ShiftRequests");
modelBuilder.Entity<MissionRequest>().MapSingleType().ToTable("dbo.MissionRequest");
我究竟做错了什么?
编辑
Column
并且Mission
也是我模型中的实体,这可以接受吗?