Alternative for MapHierarchy() in EF Code first CTP 5
How can I set the following in the new 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 })
开发者_JAVA技巧 .Case<Request2>(m => new { request2_Id = Mission.Id, m.Comment, m.Date, Discriminator = 2 })
.ToTable("dbo.Requests");
Something like this will work:
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");
精彩评论