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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:40:33+00:00 2026-05-27T05:40:33+00:00

I have a dbml file (linq to sql) to connect to my database. I

  • 0

I have a dbml file (linq to sql) to connect to my database. I have a manager that uses a generic repository (for each entity) to talk to the dbml. A manager uses the Repo to do work (CRUD operations). A WCF wraps the manager and exposes the it to the outside world (so my application can use it).

DB <–> IRepository< Entity, DataContext> <–> IManager(IRepo, IRepo…) <–> WCFService(IManager)

I’ve tested the manager, it works fine every time. The problem is the WCF. I’ll read data (e.g. GetAllLocations), update the data (e.g. change a Location name), but then at some random point later, I’ll read dirty data. E.g. if I’ve been changing a location name to from “BC 1”, to “BC 2”, to “BC 3”, sometimes I’ll read it and get older values. Like after I’ve changed it to “BC 3” and I am expecting to read “BC 3”, I get “BC 1” (which doesn’t make sense since the value before the update was “BC 2” anyway). WCF does not have caching by default, so why is this happening on my WCF and NOT on my manager? All the WCF does is pass values to the manager and get values from the manager, it’s a very basic wrapper class.

NOTE: I am using StructureMap to automatically resolve DependencyInjection and IoC stuff.

Problem methods: anything that’s reading (e.g. GetLocationById and GetAllLocations). They just don’t always return the latest data from the database. I know it’s not the manager because I created a simple project to test both the Manager and WCF independently, and only the WCF had dirty reads after updating data (specifically the Location). I have not testing all the other entities yet.

One final note: I kept getting the “System.Data.Linq.ChangeConflictException: Row not found or changed.” exception. I changed the DBML designer Location Entity’s properties (except the PK) to Update Check: Never. The dirty reads were happening before this change anyway and the manager works fine (and it uses the DBML). So I have no reason to believe this is causing the dirty reads.

Also, the Location Entity has a trigger in the database, but I’m eliminated this as the cause because I disabled it and that didn’t help, and once again, the manager works fine.

  • 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-27T05:40:33+00:00Added an answer on May 27, 2026 at 5:40 am

    Turns out this was a caching issue caused by using WCF and Structure Map. I’d changed the default structure map caching when registering my data contexts in the data registry.

    For<MyDataContext>()
       //.HybridHttpOrThreadLocalScoped()
       .Use(() => new MyDataContext());
    

    The default was per call which is what I needed.

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

Sidebar

Related Questions

In my project I have my Linq To SQL dbml file, A Repository Layer
I am using Visual Studio 2010, and I have a LINQ-to-SQL DBML file that
I have two tables in a LINQ to SQL dbml file. I am trying
Do you have one gigantic linq to sql DBML or Linq to entities .EDMX
I have been going round and round with a linq to sql file while
I am generating the LINQ-to-SQL DataContext and entity classes for a database. The database
Possible Duplicate: How to update Linq to SQL dbml file? Is there a quick
I have a LINQ to SQL class that I am reading into a List.
I have this Linq to SQL query sequence that is basically returning a search
I'm designing my database and LINQ To SQL ASP.NET web application. Imagine I have

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.