0

I have TPH inheritance. In OnModelCreating I specify mapping like this:

modelBuilder.Entity<Parent>()
   .Map<Child1>(m=>m.Requires("TypeCode").HasValue("A"))
   .Map<Child2>(m=>m.Requires("TypeCode").HasValue("B"))
   ...

However when I try to run the query

Parents.OfType<Child1>()

I get an error 'Invalid column discriminator'. When debugging I can see it runs the code in OnModelCreating... It seems like EF is ignoring Map definitions?

4

1 回答 1

0

请参阅添加到描述问题和解决方案的帖子的评论

于 2013-06-12T22:12:02.840 回答