Page 1 of 1

Clearing the Cache doesn't work

Posted: Sun 01 Dec 2013 16:35
by Zero-G.
Hey

I use your latest components for mySQL and LinqConnect
On Client side I have a query, which is fired quite a lot. So I hold it in Memory.
When I make changes to this list, I have a small function, which should fire the query to the database again.
But it Looks, like the Query Cache isn't cleared. - Because the result is not the one from the db, it is the one from the Memory.
My code Looks something like this:

Code: Select all

If myLocatedObject.HasToBeUpdated = True Then
            Dim nCache = Devart.Data.Linq.CompiledQueryCache.GetCache(GetProvider.GetType)
            nCache.Clear()
            _Firmendaten = From Query In GetProvider.Firmendatens Select Query
        End If
        Return _Firmendaten
I step through the code and see, that "myLocatedObject" has the true value. - So, the Cache.Clear is fired. - But I still get the result from the Memory, - The Select Query runs not against the db.
Please give me advise to this.

THX

Re: Clearing the Cache doesn't work

Posted: Mon 02 Dec 2013 13:42
by MariiaI
The compiled query cache stores queries only, not the objects being retrieved.
In your case, you should use one of the following options:
- either use the Refresh() method:

Code: Select all

GetProvider.Refresh(Devart.Data.Linq.RefreshMode.OverwriteCurrentValues, _Firmendaten)
- or disable the entity cache:

Code: Select all

GetProvider.EntityCachingMode = EntityCachingMode.None
For more information please refer to:
http://forums.devart.com/viewtopic.php?f=1&t=24262
http://msdn.microsoft.com/en-gb/library ... hmode.aspx
http://www.devart.com/linqconnect/docs/ ... fresh.html