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 8016915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:40:51+00:00 2026-06-04T20:40:51+00:00

I have a requirement to build a slightly unusual data model, but I’m having

  • 0

I have a requirement to build a slightly unusual data model, but I’m having trouble persuading Entity Framework Code First to map it for me.

I have two entities – ‘A’ and ‘B’.

‘B’ is a type of ‘A’, which is why I’m trying to get inheritance working.

However, multiple versions of ‘B’ may exist.

I would like to model this by having a shared ID column in each of the tables for ‘A’ and ‘B’, but for ‘B’ to also have a ‘Version Number’ field which makes a combined key with the ID.

So – this would be a one-to-many inheritance type of arrangement.

Ultimately the goal for this would be to be able to retrieve a specific ‘B’ entity and for it to also contain all of the properties and methods of the related ‘A’ entity without having to go via another object.

Any ideas would be great.

Thanks,
Chris

  • 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-04T20:40:52+00:00Added an answer on June 4, 2026 at 8:40 pm

    Inheritance in EF is always one-to-one. If you have one-to-many you must handle it as relation or build your own intermediate layer which will hide EF implementation by your own domain model (which will take related objects from EF and create your own inherited object).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an slightly unusual security requirement, and I'm looking for advice on best
I never worked with Silverlight before, but I have the requirement to build a
I am planning to build compiler for Requirement Specification Language. I have come up
I have following requirement, I have C#/.Net console application, which refers to 'System.Data.Sqlite.dll' 'System.Data.Sqlite.dll'
I have a requirement to build an application that a company can use to
I have a requirement to build a Business Rule Engine. I use the SQL
I have a requirement to build branded e-commerce sites that have their own urls
I have a requirement to build an MS Word 2007 plugin that provides a
I have the requirement to build a asp.net sign up form which will allow
My Application can perform 5 business functions. I now have a requirement to build

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.