Due to huge volume of data, our SL4 application encounter problem by getting slower. To solve that we decide to do paging and sorting serverside.
Database structure:
The paging at server side went all ok, while trying for sorting, I can sort easily for "CustomerLabel" using:
IEnumerable<Customer> source = this.ObjectContext.Customers.Include("Person");
source = source.OrderByDescending<Customer, object>(p => GetKeySelector(p, propertyName));
private static object GetKeySelector(Customer p, string propertyName)
{
PropertyInfo propertyInfo = target.GetType().GetProperty(propertyName);
return propertyInfo.GetValue(target, null);
}
Problem: while propertyName is "Person.FirstName" in datagrid. The "propertyInfo " is null.
I wish if someone could help me on this.
I'm not sure I understand why you aren't using the built-in functionality. Does this post cover the kinds of things you want to do?