【问题标题】:Server side dynamic sorting and paging in silverlight 4 with WCF RIASilverlight 4 中的服务器端动态排序和分页与 WCF RIA
【发布时间】:2011-10-24 12:26:40
【问题描述】:

由于数据量巨大,我们的 SL4 应用程序遇到了变慢的问题。为了解决这个问题,我们决定在服务器端进行分页和排序。

数据库结构:

  • 客户表是(customerID, CustomerLabel, personId)
  • 人员表是(personId, FirstName)
  • Datagrid 有 (CustomerLabel, FirstName)

服务器端的分页一切正常,在尝试排序时,我可以使用以下命令轻松排序“CustomerLabel”:

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);
}

问题: 而 propertyName 在 datagrid 中是“Person.FirstName”。 “propertyInfo”为空。

希望有人能帮我解决这个问题。

【问题讨论】:

  • 我不明白第一行代码是如何编译的。

标签: silverlight-4.0 wcf-ria-services


【解决方案1】:

我不确定我是否理解您为什么不使用内置功能。这篇文章是否涵盖了你想做的事情?

WCF RIA Services DomainCollectionView

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-06-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多