Carmax
Carmax

Reputation: 2917

EF Table per Type - Handling a Derived Class With No Extra Properties

I have an abstract class I use as a base for a number of other classes.

Some of the derived classes have lots of extra properties, so I think I'm best off using Table per Type. But there's one derived type that doesn't have any extra properties.

But I'd like to keep it distinct from the base class for behavioral reasons.

How might I handle this in EF?

Upvotes: 0

Views: 136

Answers (1)

Moho
Moho

Reputation: 16498

The derived class' table would have a foreign key to the base table's record only (and possibly a PK field if the FK is not the PK), so the derived table would either be [BaseTableId] only or ( [DerivedTablePK], [BaseTableId] )

Upvotes: 1

Related Questions