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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:48:29+00:00 2026-05-25T19:48:29+00:00

I have ThirdParty entity and two derived entities: Supplier and Customer. I have another

  • 0

I have ThirdParty entity and two derived entities: Supplier and Customer.
I have another entity called Worker, with Supplier as a member:

public abstract class ThirdParty { }
public class Supplier : ThirdParty { }
public class Customer : ThirdParty { }

public class Worker {
    public virtual string Name {get;set;}
    public virtual Supplier Supplier {get;set;}
}

When I get Worker from the database using the entity framework I get the following exception:

There are no EntitySets defined for the specified entity type ‘CompanyData.Supplier’. If ‘CompanyData.Supplier’ is a derived type, use the base type instead.

The error tells me to use ThirdParty type instead of Supplier type for the Supplier member. But I want to Supplier to be with Supplier type and not ThirdParty. How can I fix this?

  • 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-25T19:48:30+00:00Added an answer on May 25, 2026 at 7:48 pm

    Use a reference(variable) of ThirdParty to store members belonging to both Supplier and Customer (abstract classes cannot have instances but can have references). Any virtual methods of ThirdParty will have implementation in both Supplier and Customer, and any methods that have different implementations for ThirdParty, Supplier and Customer, the appropriate method will be called because of Polymorphism. So receiving them from the DB in a reference of ThirdParty will not cause any problem. Ofcourse there’ll be small problem if there are methods that are not in ThirdParty but in either Supplier or Customer, but again you can always typcast.

    Hope this helps.

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

Sidebar

Related Questions

I have a Java program that loads thirdparty class files (classes I did not
I have Value-Objects/Beans (only containing members, no logic): public class Parent { String first;
I have a thirdparty .net dll being reference and used by my dll/class library
I have a third party library that internally constructs and uses the SqlConnection class.
I have a problem to insertNewObject in an entity being the child in a
I have a module that is used by creating a custom class loader. The
I have my asp.net mvc 3 application with entity framework and i used the
I have a table that holds data received from a thirdparty via an api
Suppose you have entities A, B, C and D. D relates to C C
I have a thirdparty script that I don't want to rewrite in CGI/Perl, so

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.