sorting EntityView2 with ISortExpression

Posts   
 
    
rblasutig
User
Posts: 11
Joined: 22-Feb-2008
# Posted on: 18-Jul-2008 23:22:16   

I got some unusual sorting behavior when applying the sort expression twice to the view:


ISortExpression sorter = new SortExpression();
sorter.Add(field1 | SortOperator.Ascending);
sorter.Add(field2 | SortOperator.Ascending);
sorter.Add(field3 | SortOperator.Ascending);
EntityView2<MyEntity> myView = new EntityView2<MyEntity>(myEntityCollection, sorter);
myView.Sorter = sorter;

When I create the view with the SortExpression OR assign it to the view later, it is fine. It is when I apply it (accidentally) using both options that the sorting doesn't appear to work.

I'll leave it up to you if such behavior is undesirable, non-redundant code fixes it simple_smile

This is using LLBLGen 2.6.8.709 in VS 2008.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 19-Jul-2008 06:39:16   

Reproduced with three fields. One or two fields is ok. We will look into it. Thanks for reporting that.

David Elizondo | LLBLGen Support Team
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39866
Joined: 17-Aug-2003
# Posted on: 19-Jul-2008 09:41:58   

Will look into it! simple_smile

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39866
Joined: 17-Aug-2003
# Posted on: 21-Jul-2008 12:25:58   

Reproduced. The sorting is completely messed up it seems.

(edit) fixed in next build. The second sort action of a view was always wrong, no matter if you passed 1, 2 or 3 fields, although it might have seemed that it was only wrong with 3 fields. The problem was that it re-used the indides in the collection as the index in the view, which went wrong in the second sort as the order was probably wrong.

Frans Bouma | Lead developer LLBLGen Pro
rblasutig
User
Posts: 11
Joined: 22-Feb-2008
# Posted on: 21-Jul-2008 19:24:36   

Thanks for looking into it and finding it so quickly.