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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T20:15:41+00:00 2026-05-20T20:15:41+00:00

I have the following classes: class Person { public string Name { get; set;

  • 0

I have the following classes:

class Person
{
    public string Name { get; set; }
}

class Employee : Person
{
    public int Salary { get; set; }
}

class Company
{
    public IList<Person> PeopleWhoAreNotEmployees { get; set; }
}

Person and Employee are mapped using table-per-class-heirarchy strategy.

When I retrieve the PeopleWhoAreNotEmployees collection, I want it only to contain elements that are Person, and NOT Employees.
How can I (fluently) configure the collection to only retrieve elements of the super class?
I think it’s something to do with the Polymorphism property, but I couldn’t really figure out how to do that.

thanks,
Jhonny

EDIT:
following the discussion with Jamie, I feel I need to clarify that the case here isn’t really Person and Employee, but more like Employee and HistoricalEmployee.
Meaning- when an employee ‘dies’, they’re not really deleted,
but they become HistoricalEmployee (with a few more attributes, such as termination date etc.).
Obviously, over time, the number of HistoricalEmployees will exceed the number of Employees by magnitudes,
so I can’t fetch all HistoricalEmployees when I only need current Employees.
Sorry for the ambigiuity of the original question…
J

P.S.
I didn’t change the original question since it would make the answer irrelevant.
a new version of this question is available here

  • 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-20T20:15:41+00:00Added an answer on May 20, 2026 at 8:15 pm

    what I ended up doing was using a ‘where’ clause on my property.
    the fluent configuration looks like so:

     mapping.HasMany(x => x.Employees)
                .Where("IsFired = 0")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose i have class Person { public int Id {get;set;} public string Name {get;set;}
I have following classes public class Person { public string FirstName { get; set;
Given the classes: public class Person { public string Name { get; set; }
I have the following (simplified) classes: public class Person { public string Id {get;
I have the following classes: public class Person { public String FirstName { set;
I have the following classes public class Person { public virtual int Id {
I have the following classes public class Person { public virtual int Id {
I have the following classes class Person { private String name; void getName(){...}} class
Let's say I have the following two classes: public class Person { public string
I have the following two classes: public class Address { public string AddressLine1 {

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.