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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:28:37+00:00 2026-05-25T02:28:37+00:00

I am trying to do something with Entity Framework that I think is pretty

  • 0

I am trying to do something with Entity Framework that I think is pretty basic, but I am new to EF, and so I need help. I am trying to use EF and LINQ to retrieve records from two tables that are in a many-to-many relationship, as I would in SQL with the following query:

SELECT  p.ProductName, pf.ProductFeatureName, pf.ProductFeatureDescription, pf.ProductFeatureActive 
FROM    ProductFeature pf
JOIN    ProductProductFeature ppf ON
    pf.ProductFeatureID = ppf.ProductFeatureID
JOIN    Product p ON
    ppf.ProductID = p.ProductID

One table is Products and the other is ProductFeatures, and their definitions, as well as the definition for an associative table, are as follows:

TABLE Product (
    ProductID INT PRIMARY KEY IDENTITY(1,1),
    ProductCategoryID INT, -- FK to ProductCategory 
    ProductName NVARCHAR(255),
    ProductDescription NVARCHAR(MAX),
    ProductImagePath NVARCHAR(1024),
    PricePerMonth DECIMAL(7,2), -- ex 11111.11
    ProductActive BIT NOT NULL DEFAULT(1)
)

TABLE ProductFeature (
    ProductFeatureID INT PRIMARY KEY IDENTITY(1,1),
    ProductFeatureName NVARCHAR(255),
    ProductFeatureSummary NVARCHAR(255),
    ProductFeatureDescription NVARCHAR(MAX),
    ProductFeatureActive BIT NOT NULL DEFAULT(1)
)

-- ProductCategory to Product association table
TABLE ProductProductFeature (
    ProductProductFeature INT PRIMARY KEY IDENTITY(1,1),
    ProductID INT, -- FK to Product 
    ProductFeatureID INT -- FK to ProductFeature
)

How can this be accomplished?

  • 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-25T02:28:37+00:00Added an answer on May 25, 2026 at 2:28 am
    from p in ctx.Products
    .Include("ProductProductFeatures")
    .Include("ProductProductFeatures.ProductFeatures")
    select p;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to Entity Framework, and I'm think there is something that I misunderstand
For the past days I've been trying to use Entity Framework and LINQ 2
I've an Entity Framework model (v.1.0) that I'm trying to extends with a calculated
I am using Entity Framework with asp.net mvc, but I don't think mvc plays
I am new to LINQ and Entity Framework and I am stuck on a
I think I should mention I'm trying to get Entity Framework\SQL server to do
We are trying to find a workaround for the issue that the Entity Framework
I am trying to use data annotations to validate my Entity Framework models using
I'm new to Entity Framework and am trying to figure things out. I have
I am using Entity Framework with Linq to Entities, trying to select some data

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.