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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:44:55+00:00 2026-06-18T08:44:55+00:00

I am simulating a join on a linked server through linq to sql. My

  • 0

I am simulating a join on a linked server through linq to sql. My question is, it appears that linqtosql is bringing all the rows for y.Xstatuses into memory and then doing the join. If this is true how do i keep all the memory on sql server(and still do a cross datacontext join operation), if this not true what is going on that is eating all my ram?

var x = new fooDataContext();
var y = new barDataContext();

var allXNotDeleted = (from w in x.CoolTable
                      where x.IsDeleted != false).ToList();//for our demo this returns 218 records

var allXWithCompleteStatus = (from notDeleted in allXNotDeleted
                              join s in y.XStatuses on notDeleted.StatusID equals s.StatusID
                              where s.StatusID == 1
                              select notDeleted).Tolist();// insert massive memory gobbler here

return allXwithCompleteStatus;

EDIT:
Trying to implement Kevinbabcock’s idea

    using (x = new fooDataContext())
    using (var y = new barDataContext())
    {

        var n = (from notDeleted in x.GetTable<CoolTable>()
             join z in y.GetTable<Xstatus>() on x.StatusID equals z.StatusID
             where z.StatusID == 1 and x.IsDeleted != false
             select x).ToList();

    }

This still throws a cross context query exeception

  • 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-18T08:44:56+00:00Added an answer on June 18, 2026 at 8:44 am

    It is not possible to perform cross data context query directly on the database.
    Fetching in memory one of the recordset (ToList()) forces anyway the other joined to be processed in memory.

    If you want to perform everything on sql server you have to have every entity in the same DataContext.

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

Sidebar

Related Questions

Possible Duplicate: Simulating group_concat MySQL function in MS SQL Server 2005? I have a
Possible Duplicate: Simulating group_concat MySQL function in Microsoft SQL Server 2005? I have 2
Possible Duplicate: Simulating group_concat MySQL function in MS SQL Server 2005? Does T-SQL have
Possible Duplicate: Simulating group_concat MySQL function in SQL Server 2005? What's the best way
Possible Duplicate: Simulating group_concat MySQL function in MS SQL Server 2005? I have a
Possible Duplicates: Simulating group_concat MySQL function in MS SQL Server 2005? Concat groups in
Possible Duplicate: Simulating group_concat MySQL function in MS SQL Server 2005? I have two
Possible Duplicate: Simulating group_concat MySQL function in MS SQL Server 2005? SQL Query for
How to simulating two client-controlled vehicles colliding (sensibly) in a typical client/server setup for
I am simulating a multi-column combobox by introducing spaces between each column, such that

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.