Print Page | Close Window

Queries with different sort order

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=3229
Printed Date: 13-May-2026 at 11:29am


Topic: Queries with different sort order
Posted By: hijaggu
Subject: Queries with different sort order
Date Posted: 23-Jan-2012 at 4:24pm

  IEntityQuery<Zip> qryZips = new EntityQuery<Zip> ()
                             .Where<Zip> ( p => p.State.StartsWith ( "CA" ) );

So all California zip codes are in cache now.

What would happen if I execute the same query with order by criteria while displaying them in grid on UI.

   CompositeSortSelector OrderByCriterion = new SortSelector ( typeof ( Zip ), "City"ListSortDirection.Ascending )                                .ThenBy ( "Code"ListSortDirection.Ascending );


IEntityQuery<Zip> qryZips = new EntityQuery<Zip> () .Where<Zip> ( p => p.State.StartsWith ( "CA" ) )
.OrderBySelector<Zip> ( OrderByCriterion ); Is it going to hit the database OR will pull the entities from cache and will apply necessary sort criterion?



Print Page | Close Window