Print Page | Close Window

EntityQuery with Top and OrderBy removes other entity from cache?!

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=2079
Printed Date: 23-Apr-2025 at 8:53am


Topic: EntityQuery with Top and OrderBy removes other entity from cache?!
Posted By: Ficht-Man
Subject: EntityQuery with Top and OrderBy removes other entity from cache?!
Date Posted: 20-Aug-2010 at 7:07am
Hello everybody,

recently i had a strange problem with "TOP queries", PersistenceManager-Cache and SortOrder...

It took a while till i found a way to reproduce the following:

In my winform-application i have a 2 gridview showing some Employee-Entities and a "LoadData"-Button for each of them

Button 1:

var q = new EntityQuery(typeof(Employee));
q.Top = 20;
q.AddClause(Employee.FirstNameEntityColumn, EntityQueryOp.NE, "Abc");
q.AddOrderBy(Employee.FirstNameEntityColumn, ListSortDirection.Ascending);

Button 2:

var q = new EntityQuery(typeof(Employee));
q.Top = 1;
q.AddClause(Employee.FirstNameEntityColumn, EntityQueryOp.NE, "Abc");


I used the default PM for both queries..

After pressing button 1 some entities appear in GridView 1.
After pressing button 2 one entity appears in GridView 2 BUT ANOTHER ENTITY DISAPEARS out of GridView 1?!

AS you see above, the query for button 2 has no sort criteria.
To reproduce this problem i had to change the PK column in dhe entity-mapper from ID to another column. AS long as the ID-Column was defined as PK it worked.

Please let me know if there is a reason for this that i do not see..

Best Regards

P.S.: i think the problem is, where the persistencemanager merges the refetched data with the cached data.
do have any cache-data-obsoletion-detection mechanism that kicks out the wrong record for some reason?



Replies:
Posted By: davidklitzke
Date Posted: 20-Aug-2010 at 4:38pm
Can you send an email to IdeaBladeSupportTrack at ideablade dot com with the same subject line?



Print Page | Close Window