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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T02:27:18+00:00 2026-06-06T02:27:18+00:00

So we copy and paste the exact same query from LinqPad into our EF

  • 0

So we copy and paste the exact same query from LinqPad into our EF 4.3 application, pointed at the exact same database and get a different result. In LinqPad we get 2 records returned. In our application we reaise an error “Object reference not set to an instance of an object.”

        var Shippings = shippingRepository.All.ToArray();
        var SalesOrderHeaders = salesOrderHeaderRepository.All.ToArray();
        var Customers = customerRepository.All.ToArray();
        var Stores = storeRepository.All.ToArray();
        var Departments = departmentRepository.All.ToArray();

        var toShip = from sh in Shippings
                     join h in SalesOrderHeaders on sh.OrderId equals h.SalesOrderHeaderId
                     join c in Customers on h.CustomerId equals c.CustomerId
                     join st in Stores on h.StoreId equals st.StoreId
                     join d in Departments on h.DepartmentId equals d.DepartmentId into outer
                     from o in outer.DefaultIfEmpty()
                     select new 
                     {
                        OrderId = sh.OrderId,
                        CustomerName = c.Name,
                        StoreName = st.Name,
                        DepartmentName = (o.Name == null) ? o.Name : "None",
                        DeliveryDate = h.DeliveryDateTime
                     };

In the application code, when we remove the outer join (to add Departments) and it’s associated field the query returns the same 2 records asn in LinqPad.

Does anyone have any insight into how to fix this feature?

  • 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-06T02:27:19+00:00Added an answer on June 6, 2026 at 2:27 am

    Click on “Add a connection” in linqpad and select datacontext from assembly like
    enter image description here
    You can choose Entity Framework datacontext or Entity Framework BDContext with POCO depending upon your scenario. click next and provide path to the assembly along with connection string and you will be good to go.

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

Sidebar

Related Questions

I'm a PHP/MySQL developer who hasn't used any form of versioning aside from copy/paste
I copy and paste code from this URL for creating and reading/writing a proc
How do I copy and paste a file with the clipboard from a compressed
im following this example http://jsfiddle.net/rniemeyer/badZb/ . I just copy and paste the exact code
When I copy-paste code from Websites (for example: http://www.west-wind.com/Weblog/posts/154812.aspx ) Visual Studio 2010 adds
I was trying the TabLayout Tutorial from official developers site. I didnt copy paste
I want to copy/paste a file from one folder to another folder in windows
We need to stop copy paste of few characters like '<' or '>' or
I want integrate CPD (Copy-Paste-Detection) to my iOS project. I read about it here
I am not a fan of boilerplate code: copy-paste reuse is potentially error-prone. Even

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.