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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T20:36:03+00:00 2026-05-11T20:36:03+00:00

I have had a road-block that has cascaded itself down to the situation described

  • 0

I have had a road-block that has cascaded itself down to the situation described below. I haven’t had much help with people answering my previous questions, (i think i have to learn to frame them better) but i hope someone can at least explain this to me (i am a newbie to LINQ and haven’t had an opportunity as yet to read into it at any great length).

I’m using a Repository Model to access data through LINQ-to-SQL. I am trying to use 1 data-context declared as a public static so that i’m always using the same context.

Problem 1: webpages were loading with cached values immediately after saving changes. The changes were propagated to the db, but the datacontext was spitting out a cached copy of the object.

Workaround: Set ObjectTrackingEnabled = false on the datacontext.

Problem 2: Now, objects cannot lazy-load – all entities within the given object are null when i examine them during debugging.

Workaround: Set DeferredLoadingEnabled = false on the datacontext.

Problem 3: LINQ doesn’t automatically set Immediate-loading for all entities associated to the given object.

Workaround: Explicitly configure LoadOptions for the datacontext and manually identify each associated entity by setting LoadWith<Object>(o => o.entity1), LoadWith<Object>(o => o.entity2), …, LoadWith<Object>(o => o.entityN).

Can some help me get past the caching problem without having to deal with the rest?

If not, can someone tell me if there’s another way to set ImmediateLoadingEnabled (or something like that) on the data context, so that i don’t have to explicitly state the loading options for all entities associated with all objects in my domain?

I’d really appreciate some feedback. If i’m asking questions without enough information or if you’d like an example, please let me know!

Thank you in advance!

  • 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-11T20:36:03+00:00Added an answer on May 11, 2026 at 8:36 pm

    You can’t use a single context for a webapplication, as a webapplication is multithreaded (1 thread per request for example) and this would mean that multiple threads are using the same context. I.o.w.: you should use a system where for each request of data, you create a new context and use that for the query to execute, then dispose the context.

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

Sidebar

Related Questions

I have had several situations when i would like to do that. This could
I'm on the road at the moment and just had a thought I have
We have had our glassfish instance go down every two weeks for a while
OK, another road bump in my current project. I have never had form elements
I have had this problem for a while and it has been driving me
I have had an online archive service for over a year now. Unfortunately, I
I have had to compile my app for the 4.0 sdk to run on
I have had a persistent problem with Visual Studio 2010 and any framework version
I have had this problem crop up a few times and I can't figure
I have had a look all over, but it doesn't seem as though my

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.