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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T20:26:19+00:00 2026-05-17T20:26:19+00:00

I am using ASP.NET MVC framework and accessing DB records with Entities. I am

  • 0

I am using ASP.NET MVC framework and accessing DB records with Entities.
I am doing some joins like this:

public IQueryable<...> GetThem()
{
    var ords = from o in db.Orders 
              join c in db.Categories on o.CategoryID equals c.ID 
              select new {Order=o, Category=c};

    return ords;
}

I need to use/pass ‘ords’ from one function to other in a strongly-typed manner.
(I will be doing this kind of joins in multiple places.)

What is the best way to do this?
Do I need create a new class containing both returned vals for every join I do?
Eg: public class OrderAndCategory { public Order; public Category; } in this case.

Is there any simpler way?

Thanks!

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

    The class representing the data in ords is strongly typed, it is generated by the compiler. You could run into problems though if the compiler generates different classes for different instances of the query, but with the same types. You’d have to check that. If this is the case, you’ll have to create classes for each different query, or use the class Tuple<Targs...> instead.

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

Sidebar

Related Questions

Using asp.net MVC I'd like to do this inside a view: <%= Html.TextBox(textbox1, null,
I am fairly new at using the ASP.NET MVC framework and was hoping that
I am wondering what experiences people are having using the ASP.NET MVC Framework? In
My team is considering building our next web app using the ASP.NET MVC framework.
Im currently using vs2008 with asp.net mvc framework for web development. Im missing a
Is it possible to make a site with ASP.NET MVC Framework using .NET 2.0?
I'm using ASP.NET MVC Preview 4 and would like to know how to use
If you are using ASP.NET MVC how are you doing grid display? Rolled your
I'm about to begin building a website using the ASP.NET MVC framework and I'm
I'm using ASP.NET MVC Framwork and trying to grok the ASP Membership 3.5 stuff.

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.