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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:24:10+00:00 2026-05-16T11:24:10+00:00

Ok obviously I am fighting .net here … and the answer is probably that

  • 0

Ok obviously I am fighting .net here … and the answer is probably that i am barking up the wrong tree and should just get on with just using the kind of database design i would of 5 years ago.

What I want is to have an abstract object Client and have 2 inherited objects Supplier and Customer.

The relationship between client and both supplier and customer is 1: 0/1

This seems to mean that a solution based on inheritance would work well as it would enable me to write less validation code as well as lever the strongly typed collections.

However out of the box entity framework insists on using unique id’s on the client table and refusing to let you have the same id referenced from the Customer and supplier tables.

when you go into the database and edit this id manually to be the same on both inherited objects you then get problems because the collection of clients has an index collision (unsuprisingly).

the result is that I cannot have a client who appears as both a supplier and a customer (I was happy with the idea of 2 seperate objects sharing the same id).

This leads into a design question of how to best model this scenario … I am at risk of having to do a conditional join and boolean fields for ‘isCustomer’, ‘isSupplier’ or a suppliers and customers table that joins to client and write code to maintain the a 0-1 relationship with it.

Someone else must of had this kind of issue? No elegant solutions?

an alternative:
I need multiple views of the same object. This means that I cannot simply have an integer value on one field determining which views are allowed. I require using several bool fields to determine what object views are allowed.

Is this possible in EF? Obviously I can create views in the DB, but id rather do this from EF and have it create the SQL. (although i am already defining sp’s to set up various keys and constraints in the db, but this means i am getting more and more likley to abandon using EF to generate my schema)

  • 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-05-16T11:24:11+00:00Added an answer on May 16, 2026 at 11:24 am

    Unfortunately, what you’re asking for isn’t really possible. .NET doesn’t allow for multiple inheritance, so this isn’t (and won’t be) a feature of EF or any other ORM.

    You’ll have to remove the inheritance in the EF designer and just allow a normal 1:1* association between the tables.

    You’ll end up with the database design you’re looking for, and your C# syntax will look like:

    Client c;
    
    c.Customer.[...]
    c.Supplier.[...]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Obviously, that's 64-bit windows. Also, what's the maximum amount of memory a single 64-bit
Obviously I can use BCP but here is the issue. If one of the
Obviously I could create a Calendar object with the date and use get(DAY) on
It obviously depends on the context you are using them in but, I was
Okay still fighting with doing some SqlCacheDependecy in my Asp.net MVC application I got
Obviously there are security reasons to close a wireless network and it's not fun
Obviously (methinks), creating an index on a BIT column is unnecessary. However, if you
Obviously it gets updated during a write operation, but are there any non-destructive operations
Obviously having whitespace in css, aspx and html pages is a great advantage at
Obviously I can do and DateTime.Now.After - DateTime.Now.Before but there must be something more

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.