Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8475177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T17:49:30+00:00 2026-06-10T17:49:30+00:00

Is it possible to define Inheritance Mapping and a Discriminator Property using a BD

  • 0

Is it possible to define Inheritance Mapping and a Discriminator Property using a BD first approach.

I use the EDMX diagram to define the mapping of tables to object.
I have a DomainEntity Table that contains all my domain entities and they are descriminated by TypeID that is mapped to a DomainEntityTypes table.

If i had full control i would design the mapping this way:

  1. Define an abstarct class DomainEntity
  2. Inherit from the DomainEntity calss to creat concrete entities
  3. Use the Inheritance Mapping Annotation and the IsDiscriminator Annotation over the TypeID
  4. Use an enum to define all possible types (and i wonder what the types table is for from that point)

Could all this be defined in the EDMX file somehow ? or do i need to stop using auto generation and continue with manual mappings?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T17:49:32+00:00Added an answer on June 10, 2026 at 5:49 pm

    There is no “auto-generation” of inheritance mapping. When you use database first you simply load tables to your model and it will create entities with relations. Now if you want to have inheritance you must modify the mapping from the designer. Here is a nice description how to set up TPH inheritance in the designer.

    1. You can define base entity for your inheritance hierarchy as abstract. It is property of the entity in the diagram.
    2. You must inherit a new entity for all types you want to use and correctly set up its discriminator value in the mapping.
    3. There are no real annotations – inheritance is a construct available in the ToolBox and discriminator is a condition defined in the mapping.
    4. You will have no enum. Discriminator column will even not be available in your entities because it is already used to define mapping to correct type (there is limitation that each column can be used only once in the mapping so you can use it either for property or for discriminator but not for both). You will have finite set of entities to describe your inheritance hierarchy instead of enum.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Define a method that has many (or infinite) arguments I have the
Is it possible to define an interface (e.g. MyClass Implements MyInterface) whose method/property definitions
It's possible to define an alias in C# like this using kvp = System.Collections.Generic.KeyValuePair<string,
Is it possible to use generic support with single table inheritance, and still be
Possible Duplicate: Enum “Inheritance” I have a number of classes which extend an abstract
I am using prototypal inheritance in JavaScript and have hit an issue I can't
I understand multiple inheritance and interface to an extent. Is it possible to use
Possible Duplicate: Is it possible to define enumalpha? Is there any equivalent of Java
Is it possible to define a binding between an exchange (direct or topic) and
Is it possible to define some sort of capitalize() or toLowerCase() function when creating

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.