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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:47:59+00:00 2026-06-13T07:47:59+00:00

I read here that when querying data for a read operation, setting ObjectTrackingEnabled to

  • 0

I read here that when querying data for a read operation, setting ObjectTrackingEnabled to false gives somewhat of a performance boost. My queries look like this:

public return type TheQueryName (some parameters)
{
   using (TheDC MyDC = new TheDC())
   {
       var TheQuery = (...).ToList();

       return TheQuery;
   }
}

1) If I want to add the performance enhancement, do I just add the line ObjectTrackingEnabled = true; just before the line var TheQuery = (...).ToList();

2) Also, if I set ObjectTrackingEnabled to true in a query, do I need to set it to false before returning or am I just setting ObjectTrackingEnabled for the particular instance of the data context and the following time I’ll instantiate a new data context the value of ObjectTrackingEnabled will revert back to its default state of false?

Note: I only plan do add ObjectTrackingEnabled = false; to read operations.

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-06-13T07:48:00+00:00Added an answer on June 13, 2026 at 7:48 am

    ObjectTrackingEnabled controls whether your Data Context (TheDC in your case) will track changes to the entities after they’re loaded. Whether you want that or not depends on your specific case.

    Naturally, having the Data context do fewer things will make it go faster, but at the expense of burdening you with tracking changes. Why is change tracking cool? Because you can:

    1. Load up some entities from some context
    2. Modify them
    3. Add new ones, delete others
    4. Call SaveChanges and let the data context figure out to do UPDATE queries for modified entities, DELETE for deleted ones, etc

    With change tracking disabled, you have to tell the context explicitly what changed, what the new values are, etc.

    Assuming you still don’t want object tracking, the property is set on each specific data context instance. This means you have to either:

    1. Set it manually for every data context you create
    2. Set it as a default for the context in the context’s constructor like so: this.Configuration.AutoDetectChangesEnabled = true; See this blog post for details

    Hope this helps!

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

Sidebar

Related Questions

I have read here* that ontologies (RDF's in nature) are data-driven because one can
I've read here and here that there is a device setting to support equivalent
I've read here that matplotlib is good at handling large data sets. I'm writing
Hy there, i just read here that posted data can't be sent by a
I've read here that editing a file in-place is not possible since it's OS
I've read several questions here that seemed to be related (either directly or indirectly)
Possible Duplicate: Search-like highlighting in NSTextView I thought i read here months ago that
I've read a few answers on here that condemn the use of svn:externals. I
I read here about std::auto_ptr<>::operator= Notice however that the left-hand side object is not
I have an XML file that I'm trying to read from here , and

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.