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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:25:57+00:00 2026-06-01T02:25:57+00:00

I am using Entity Framework, POCO entities and repository pattern for data access. I

  • 0

I am using Entity Framework, POCO entities and repository pattern for data access. I have a repository class which returns me Iqueryable of a particular type.

In my database I have a many to many relationship table.
Tables are like TemplatesTable and UserTable and junction UserTemplate table

One user can have multiple templates. So there is a junction table for mapping userid and templateid. Now I have to display all the template data like name, other details for users.
What is the best way to do this in EF POCO way?

Right Now I am following this approach which is working but I understand it is not the best way.

var Tempaltes = TemplateRepository.All();

var templateforUser = UserTemplateRepository.where(UserId==1)

var userTemplates= from tmp in Templates

                   join tmpusr in templateforUser  on tmp.TemplateId equals tmpusr.TemplateId
                            select tmp;

return userTemplates.ToList();

Please suggest what is the best way to carry out this.

  • 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-01T02:25:58+00:00Added an answer on June 1, 2026 at 2:25 am

    The correct approach is to have Templates navigation property on your User entity. Than you just need to use eager or lazy loading to fill navigation property and you never need to use anything like custom join.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Entity Framework for creation of my Data Access Layer and I want
Using Entity Framework 4.1 code first and POCO entities in MVC3; I would like
I am using Entity Framework POCO to generate some self-tracked data objects, and I
I have several entities generated from my Entity Framework data model. In the .edmx
I'm using Entity Framework 4 and I have created a UnitOfWork class that creates
I have an Entity Framework POCO class that is generated by a T4 Template.
I have combined RIA Services with Entity Framework using POCO's. It's all worked wonderfully
What does one loose by creating POCO using T4 templates in entity framework 4.0?
I am using Entity Framework with my website. To improve performance, I have started
I'm using Entity Framework in my project, and I have the problem that, once

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.