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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T04:10:40+00:00 2026-05-30T04:10:40+00:00

I have two tables/entities Users and Companies . Both are linked m-n relationship. When

  • 0

I have two tables/entities Users and Companies.
Both are linked m-n relationship.
When I use those tables in my EDMX and generate the POCOs, the m-n mapping table disappears (seemingly becasue there is nothing in there except hte two PKs).

Instead, navigation properties get created by the EDMX, which is fine:

user.Companies ... -> gives me all users for that company

and

company.Users ... -> gives me all companies for that user

But what if I wanted all users that do NOT have a company associated with them?
How would I access the missing table to create the proper join?

  • 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-30T04:10:41+00:00Added an answer on May 30, 2026 at 4:10 am

    You should find users without company (as you said), so their use.Companies.Count should be zero, just convert this to linq (like what is below):

    var withoutCompanyUsers = Users.Where(x=>x.Companies.Count() == 0).ToList();
    

    Edit: About your second problem: But what if I wanted all copmanies that are not associated with the given user?

    In this case you should find companies which doesn’t have specific user:

    Checking company has specific user or not:

    company.Users.Any(x=>x.ID = givenUserID)
    

    Fetching companies without specific user:

    var companies = Companies.Where(x=>!x.Users.Any(y=>y.ID == givenUser.ID)).ToList();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables, for Users and Songs. I need to JOIN them both
I have two tables Group and Customer and of course two entities Group and
Let's say, I have two tables, entities and tags. Relation between them is expressed
I have two tables: Users and Profiles. A user may have a profile and
I have two tables table1 , table2 . Both have a one to one
I have two tables users(id, username, password) and user_badges(user_id, badge_id, badge_slot) I would like
I have two entities, projects and users. These are modeled in Rails using Mongoid
I have the following two entities with a bi-directional OneToOne relational mapping, data access
I have two tables named USER and ROLE with entities as USER and ROLE
I have two entities: User and Notice , they are linked together via the

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.