I'm not sure whether this is possible in EF, but I am creating a bunch of classes and am trying to get EF to create the tables for me.
Now EF creates my tables fine, except for a minor issue. It created the tables as:
Person - PersonId (PK)
Foo - PersonId (PK) - FooId (INT)
Poo - PersonId (PK) - PooId (INT)
Ideally, I want the PersonId in tables Foo and Poo to be a foreign key not as the primary key. Is this possible? Tried using the ModelBuilder to do this via:
modelBuilder.Entity<Foo>().HasKey(x => x.FooId).ToTable("Foo");
public class Person
{
public int PersonId { get; private set; }
}
public class Foo : Person
{
public int FooId { get; private set; }
}
public class Poo : Person
{
public int PooId { get; private set; }
}