Raj
Raj

Reputation: 4435

Entity Framework Model Multiple Table to Single Entity

I've two tables named Modules and Privileges which are related by a foreign key relationship as shown below:

alt text
(source: baburajpb at sites.google.com)

I'd like to model Module and Privilege by adding ModuleName to Privilege. Later I'd be interested in creating a derived class (Menu in the illustration) from Privilege by adding a discriminating condition on ModuleName. Is this possible using Entity Framework?

Upvotes: 1

Views: 2630

Answers (1)

Craig Stuntz
Craig Stuntz

Reputation: 126587

Can you map multiple tables to a single entity type? Sure, that is supported. However, you cannot use a mapped field of the table (ModuleName) as a discriminator column for table per hierarchy mapping. The discriminator column must be used as a discriminator alone, and must not be mapped into your client schema.

Upvotes: 1

Related Questions