Clearing the Cache doesn't work

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
Posts: 390
Joined: Sat 09 Dec 2006 12:20

Clearing the Cache doesn't work

Post by Zero-G. » Sun 01 Dec 2013 16:35


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)
            _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.


Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Clearing the Cache doesn't work

Post by MariiaI » Mon 02 Dec 2013 13:42

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: ... hmode.aspx ... fresh.html

Post Reply