Say I have the following classes:
class Tag
{
public int Id {get; set;}
public string Name {get; set;}
}
class EntityA
{
//ctor, other properties, etc
public List<Tag> Tags {get; set;}
}
class EntityB
{
//ctor, other properties, etc
public List<Tag> Tags {get; set;}
}
Is there a way in EF
to map my lone Tag class to 2 unrelated tables (EntityATag
and EntityBTag
) as well as their linking tables (EntityA_EntityATag
)? For query performance reasons I want to have 2 separate Tag
tables, but am hoping I can keep working with just one Tag
class instead of a class per table.
Thanks!
UPDATE: This is NOT the same question as mapping multiple tables to a single entity class in entity framework.
That question is about splitting a single class into multiple tables. I don't want to split my Tag class, I want to map the full class to two different tables depending on which entity I'm working with (EntityA
or EntityB
)