Hi Greg,
The EQPCV is limited in functionality and not intended for a full CRUD operation. Not having a .Clear method is one such limitation.
Having said that, another workaround that I can think of to clear the list is set the EntityQuery.QueryStrategy to CacheOnly, call EntityManager.Clear() and call EQPCV.Refresh()
_query = _entityManager.Customers;
View = new EntityQueryPagedCollectionView( _query, // Source of data PageSize, // Page size PageSize, // Load size - no lookahead caching here true, // Whether to defer the load false); // Whether to add primary key to sort columns
//other operations.........
//Clear here ClearEQPCV();
//other operations........
//Set QueryStrategy back when done _query.QueryStrategy = QueryStrategy.Normal; //or _entityManager.DefaultQueryStrategy
public void ClearEQPCV() { _query.QueryStrategy = QueryStrategy.CacheOnly; _entityManager.Clear(); View.Refresh(); }
|
This essentially tricks the EQPCV query to look into an empty EM cache. Depending on your needs, you might want to create a separate edit EM for this purpose.
Hope this helps.
Edited by DenisK - 16-Jul-2012 at 6:56pm