C
C#7mo ago
Spaxter

✅ EF Core - Not getting updated data from PostgreSQL table

I have the following method in my DbService.cs
public async Task<long?> GetLastDumpTimeStamp(string endpoint)
{
using (var context = await _dbContextFactory.CreateDbContextAsync())
{
DumpHistory? history = await context.DumpHistory.AsNoTracking().Where(row => row.Endpoint == endpoint).FirstOrDefaultAsync();
return history?.LastUpdate;
}
}
public async Task<long?> GetLastDumpTimeStamp(string endpoint)
{
using (var context = await _dbContextFactory.CreateDbContextAsync())
{
DumpHistory? history = await context.DumpHistory.AsNoTracking().Where(row => row.Endpoint == endpoint).FirstOrDefaultAsync();
return history?.LastUpdate;
}
}
Which returns a unix timestamp from a postgres table. However if I manually change the data in the column to a completely different number and call the method again I still get the old value prior to my manual change, even after restarting my app. Am I doing something wrong?
5 Replies
Spaxter
SpaxterOP7mo ago
I've tried logging the output, and this is what I get
No description
Spaxter
SpaxterOP7mo ago
But this is the row in the database
No description
Spaxter
SpaxterOP7mo ago
I've tried manually disposing the context and changing to await using ( but none of those worked either
HtmlCompiler
HtmlCompiler7mo ago
either you are connecting (or you edited) to the wrong db (happens for example with vpns), to the wrong schema, wrong table, or you have a mock somewhere
Spaxter
SpaxterOP7mo ago
Aright, turns out DBeaver which I'm using for editing the table was lying to me when it said the data was updated. After invalidating and reconnecting I saw that the value had in fact not changed. Changing the value with the psql CLI worked, thanks.
Want results from more Discord servers?
Add your server