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

  • Home
  • SEARCH
  • 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 923651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T19:13:32+00:00 2026-05-15T19:13:32+00:00

I am using Linq-to-SQL (C# 3.5) to read two tables, house and county, from

  • 0

I am using Linq-to-SQL (C# 3.5) to read two tables, house and county, from my database (SQL Server 2000). House has a CountyID column that matches an ID column in the county table. The County table has ID and CountyName columns.There is no association in the database – I added it in the dbml file. (Parent class = County, Child class = House)

Now I can query the House table and get the county name as house.County.CountyName – just what I want.

This works great unless I set EnableObjectTracking false. I get approx 3X performance improvement but the County child object in House is null.

Is there a way around 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-05-15T19:13:33+00:00Added an answer on May 15, 2026 at 7:13 pm

    When you set EnableObjectTracking to false, you also turn off lazy loading child entities as you have noticed. MSDN says…

    Deferred loading requires object
    tracking. Only the following three
    modes are valid:

    ObjectTrackingEnabled = false.
    DeferredLoadingEnabled is ignored and
    inferred to be false. This behavior
    corresponds to a read-only
    DataContext.

    ObjectTrackingEnabled = true.
    DeferredLoadingEnabled = false. This
    situation corresponds to a DataContext
    that allows users to load an object
    graph by using LoadWith directives,
    but it does not enable deferred
    loading.

    Both are set to true. This is the
    default.

    You can use the LoadWith method to populate your child entities if you want to keep Object Tracking Disabled. Please see MSDN for more information on the LoadWith

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

Sidebar

Related Questions

I'm using Linq to SQL and read in a blog post about closing database
How to select all columns from tables in join using linq Sql: select CTRL_RUN_JOB.*,
I´m using linq to sql and I have a lot of tables with foreign
I am using LINQ to SQL with Sql Server Compact Edition 3.5 and VS2008.
We are using Linq to SQL to read and write our domain objects to
I recently started using LINQ to SQL in my database later for a C#
I'm using Linq to SQL on a project and have read articles about how
I am using LINQ to SQL for my website to access two databases. The
I'm using Linq to Sql to query some database, i only use Linq to
I have a particular scenario where I wrote my code using LINQ-SQL but I

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.