New Posts New Posts RSS Feed: Subquery.AddOrderBy doesn't order so well...
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Subquery.AddOrderBy doesn't order so well...

 Post Reply Post Reply Page  <12
Author
pnschofield View Drop Down
Newbie
Newbie
Avatar

Joined: 14-Sep-2007
Location: United States
Posts: 18
Post Options Post Options   Quote pnschofield Quote  Post ReplyReply Direct Link To This Post Topic: Subquery.AddOrderBy doesn't order so well...
    Posted: 27-Nov-2007 at 3:36pm
I agree with Paul K's approach.

Here's another way you could approach the problem.  If you want your list to be sorted by a property of ShiftFilter, then conceptually, you're performing a query of ShiftFilter, and displaying a list of ShiftFilters in your UI, along with some of the properties of each ShiftFilter's related Shift entity.  You would just use an EntityQuery(typeof(ShiftFilter)), bind that to your UI controls and create additional BindingDescriptors that display the desired properties from entity A via navigation.

EntityQuery query = new EntityQuery(typeof(ShiftFilter));

query.AddClause(ShiftFilter.RosterIDEntityColumn, EntityQueryOp.EQ, rosterName);

query.AddClause(ShiftFilter.CostCentreIDEntityColumn, EntityQueryOp.EQ, costCentreId);

query.Top = 100;

query.AddOrderBy(ShiftFilter.OrderEntityColumn, System.ComponentModel.ListSortDirection.Ascending);

// Go ahead and pull down all the related Shifts
query.AddSpan(EntityRelations.Shift_ShiftFilter.ToParent);

EntityList<ShiftFilter> result = m_PersistenceManager.GetEntities<ShiftFilter>(query);

// You want the grid to display some of the properties of each ShiftFilter's parent Shift object.
// Assuming ShiftFilter has a relation property called Shift:

myGridBindingManager.Descriptors.Add("Property A", "Shift.PropertyA");
myGridBindingManager.Descriptors.Add("Property B", "Shift.PropertyB");

Paul S.



Edited by pnschofield - 27-Nov-2007 at 3:37pm
Back to Top
 Post Reply Post Reply Page  <12

Forum Jump Forum Permissions View Drop Down