EF6 - TPH foreign key mapping in derived classes using base class property
问题 I am using Entity Framework 6.0.2 with an existing database in which tags are stored in a single table that looks like this: Id : int, primary key TagType : string, determine the type of tag, either "usertag" or "movietag" ItemId : int, contains the Id of the item to which is referred (either a User Id or a Movie Id) The following classes describe this situation: public class User { public int Id { get; set; } } public class Movie { public int Id { get; set; } } public abstract class Tag {