Sorting in Design Pattern Framework 4.0

 
55   94.5
Jan 13, 2011
 
Hi am using V4 and have a question on sorting.

Lets say we have an entity of Employer which has LastName but my class Employer has it as Surname, The Framework works using the Mapper classes and converts Employer.LastName to Employer.Surname for CRUD, However as the sorting is handled by string values the UI would pass to service SortExpression 'Surname ASC',  This will fail as sorting with the dynamicLinq class parses the string to find the value Surname but the entity cannot by sorted as it expects LastName.

Am I missing something or is it an issue that needs refactoring?

Regards Owain



50   50
Jan 13, 2011
What ORM do you use?
I didn't get what in column name in database and what in entity?
Anyway, I don't see an issue. Get data from database and sort by entity column name by Linq or what you have there.

 1 comment
 
I'm using the Pattern in Action 4.0 solution and using Entity Framework. I am questioning the way the app implements sorting using dynamic strings. If your entity object field has a different name to the business object field e.g EmployerEntity.LastName Employer.Surname. The app uses Mapper.CS in Data Layer to convert correctly entity.LastName to Surname. But if you sort on UI using "Surname ASC" it will fail; it will work if UI uses "LastName ASC" , so the UI needs an understanding of the Entity/db. --- Owain Jones  Jan 14, 2011