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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:14:24+00:00 2026-06-17T07:14:24+00:00

I have these three models: public class Equipment { public int ID { get;

  • 0

I have these three models:

public class Equipment
{
    public int ID { get; set; }
    public string title { get; set; }

}

[Table("Vessels")]
public class Vessel:Equipment
{
    public string Size { get; set; }

}

[Table("Tubes")]
public class Tube : Equipment
{
    public string Pressure{ get; set; }

}

I want to show a list of Equipments with 2 columns title and type.

for example:

Title        Type
------       -------
101-1        vessel
101-2        vessel
102-3        tube

I don’t know how to make a discriminator column in Equipments to show the type of each equipments.

EDITED

If I have a discriminator in Equipment entity like:

public class Equipment
{
    public int ID { get; set; }
    public string title { get; set; }
    public string type{ get; set; }  //as discriminator
}

I can get the query in controller or repository like this:

var equipments=from e in db.Equipments
               select e;
  • 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-17T07:14:25+00:00Added an answer on June 17, 2026 at 7:14 am

    You cannot make discriminator column in terms of EF mapping – TPT inheritance doesn’t support it because the discriminator is a subtable. You can try to use something like:

    public abstract class Equipment
    {
        public int ID { get; set; }
        public string title { get; set; }
    
        [NotMapped]
        public abstract string Type { get; }
    }  
    

    and override Type property in subtypes to get the correct name. You will not be able to use that property in Linq-to-Entities queries because it is not mapped.

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

Sidebar

Related Questions

I have the following view models: public class Search { public int Id {
Here's the model I have. public class Notification { public int NotificationID { get;
Given the following Model, public class A { public string Name { get; set;
I have these three lists with the same number of elements List<String>competitoinsIDs = new
Let us suppose i have these three methods defined: int F1(int, int); int F1(float,
I have a code first model: namespace InternetComicsDatabase.Models { public class Issue { [Key]
I have two classes defined as such: public class Questionnaire { public int QuestionnaireID
Suppose I have class Foo(db.Model): bar = db.ReferenceProperty(Bar) foo = Foo.all().get() Is there a
I have a model that looks something like this: public class SampleModel { public
I have two entities in my domain model: public class Configuration : DomainEntity {

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.