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

  • Home
  • SEARCH
  • 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 5998657
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:26:14+00:00 2026-05-23T00:26:14+00:00

When you are writing a linq query that involves two tables/entities for which you

  • 0

When you are writing a linq query that involves two tables/entities for which you have already defined the relationship in your entity framework data model, do you have to define the join in the query or is there a different syntax that uses the already defined relationship?

var q =

    from c in categories

    join p in products on c equals p.Category into ps

    select new { Category = c, Products = ps };

Otherwise what is the point of defining the relationships in the EF model?

  • 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-23T00:26:15+00:00Added an answer on May 23, 2026 at 12:26 am

    If things are set up correctly you’ll have a reference property that represents the foreign key relationship, in which case you should be able to do something like:

    var q = from c in categories
            select new {Category = c, Products = c.Products};
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a very complex Linq to SQL query that returns a result set
I have a created a single LINQ query that creates a main group and
I am writing my first little Access 2003 application. I have two queries that
I have the following linq query (applied to the Northwind database) (from od in
Appreciate if I can get some help writing a LINQ that will get ALL
When writing a LINQ query with multiple "and" conditions, should I write a single
I use this LINQ query in an app I am writing: internal int GetNoteCount(DateTime
What is the best way of dynamically writing LINQ queries and Lambda expressions? I
I'm writing a LINQ to SQL statement, and I'm after the standard syntax for
Writing my first Linq application, and I'm trying to find the best way to

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.