Migrate from SortClauseFactory.Create

Posts   
 
    
Gianc1412
User
Posts: 40
Joined: 30-Oct-2007
# Posted on: 10-Dec-2009 18:30:13   

We see in the newest version documentation you recommend not using SortClauseFactory. We tried to migrate from it an now have errors.

We did have this line of code:


sorter.Add(SortClauseFactory.Create(IssueTrackerUsersFieldIndex.DisplayName, direction, "AssignedUser"));

We changed it to during an upgrade:


sorter.Add(IssueTrackerUsersFields.DisplayName.SetFieldAlias("AssignedUser") | direction);

Now an exception is generated

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

Line 47: public bool GetMultiAsDataTable(IEntityFields fieldsToReturn, DataTable tableToFill, long maxNumberOfItemsToReturn, ISortExpression sortClauses, IPredicate selectFilter, IRelationCollection relations, bool allowDuplicates, IGroupByCollection groupByClause, ITransaction transactionToUse, int pageNumber, int pageSize) Line 48: { Line 49: return base.PerformGetMultiAsDataTableAction(fieldsToReturn, tableToFill, maxNumberOfItemsToReturn, sortClauses, selectFilter, relations, allowDuplicates, groupByClause, transactionToUse, pageNumber, pageSize); Line 50: } Line 51:

Source File: C:\Liberty\Web Development\trunk\BusinessObjects\CustomerSupportBLL\DaoClasses\TypedListDAO.cs Line: 49

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 10-Dec-2009 21:10:39   

Please can you post the full text of the exception, including the stack trace ?

Thanks

Matt

Gianc1412
User
Posts: 40
Joined: 30-Oct-2007
# Posted on: 10-Dec-2009 22:10:35   

We figured out the problem. The sort cluase needed to be added like this


 sorter.Add(new SortClause(IssueTrackerUsersFields.DisplayName, direction, "OwnerUser"));