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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T23:56:00+00:00 2026-06-03T23:56:00+00:00

I have one class called Requestparent. I have 3 classes called requesttype1, requesttype2, requesttype3,

  • 0

I have one class called Requestparent.
I have 3 classes called requesttype1, requesttype2, requesttype3, all 3 inherit from RequestParent.

In one of the screens I need to make a query to show all opened requests of all types in a grid

something like:
Opened Date – Type – Opened by.

If I query the requestparent, I wont get the type.

Another solution would be to make 3 different queries to the child objects.

EF created a discriminator column automatically.

  • 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-03T23:56:01+00:00Added an answer on June 3, 2026 at 11:56 pm

    If you make a select query to a base type; then if creates join statements to the child tables and creates entities of child types.

    Thus, even if you make a query to the base table, it creates entities of child types. You can just use Entity.GetType() statement to get the type of the entity.

    For example, let’s say you have a base entity called Base and two derived entities called Derived1 and Derived2. Then if you run the following select statement;

    List<Base> temp = (from o in context.Base
               select o).ToList<Base>();
    

    You will have entities of type Derived 1 and Derived 2. Just employing oftype is enough to determine the type of the entity. For example;

    if (temp[0].GetType() == typeof(X))
       {
              .... 
       }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a class called ItemBase from which a number of classes inherit. In
I have one abstract class -let's say myBase. And I want all the classes
I have one abstract class and many child classes. In child classes are from
I have two one-to-one relations here between a class called MailAccount and the classes
I have three files: one called sql.php witch has a class db that I
I have a class User with one field called birthDate which is a java.sql.Date
I have one grails application.In that I have one model class named Book. From
I have one class called Person that basically looks like: public class Person {
I have one Class with 2 methods. The first method is called by the
i have one class called course and one class called tutorials in class i

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.