I'm trying to implement a relationship(one-to-many) for my entities which use default TPH inheritance
public abstract class base
{
public int Id { get; set; }
...
}
public class X : base
{
public ApplicationUser User { get; set; }
...
}
public class Y : base
{
public ApplicationUser User { get; set; }
...
}
public class ApplicationUser
{
public string Name { get; set;}
...
public ICollection<X> classX { get; set; }
public ICollection<Y> classY { get; set; }
}
Everything works, but the problem is that Entity Framework creates two columns in the base table - User_Id and User_Id1. How can I map it so that there is only one column for the foreign key (User_Id) and depending on the content of the record in the Discriminator column (created by EF) the foreign key would be assigned to the appropriate entity?