如何在新CTP中设置以下内容?
modelBuilder.Entity<RequestBase>()
.MapHierarchy()
.Case<RequestBase>(b => new { b.Id, b.Comment, Discriminator = 0 })
.Case<Request1>(s => new { request1_Id = Column.Id, Discriminator = 1 })
.Case<Request2>(m => new { request2_Id = Mission.Id, m.Comment, m.Date, Discriminator = 2 })
.ToTable("dbo.Requests");
答案 0 :(得分:4)
这样的事情会起作用:
modelBuilder.Entity<RequestBase>()
.Map<RequestBase>(r => r.Requires("Discriminator").HasValue(0))
.Map<Request1>(r1 => r1.Requires("Discriminator").HasValue(1))
.Map<Request2>(r2 => r2.Requires("Discriminator").HasValue(2))
.ToTable("dbo.Requests");