I have a strange issue, which I haven't experienced before. I use Entity Framework to retrieve my records.
I have the following call:
var dbOrganisation = repository.DbOrganisation.FirstOrDefault(c => c.Id == id);
I expect no caching of this call. So when I make this call, I expect it to query the database and retrieve the latest DbOrganisation object. But that is not what happens.
I call this method relatively two times relatively short time after eachother (~5-10 seconds). But in this period, a decimal value in this table, can be changed by some third party.
However, even though the value changes, the FirstOrDefault call retrieves the not updated version.
Example situation:
- I make the
FirstOrDefaultcall, and see the decimal value of the fieldCredits, is 50 - A third party changes the
Creditsto 45 - I make the
FirstOrDefaultcall 10 seconds, later, but theDbOrganisationstill have 50 in Credits
What am i doing wrong? I thought the FirstOrDefault call was not cached by default?