我有一个 WCF DataService 操作,它公开Businesses
和Customers
.
在服务器端,我按姓氏对每个企业的客户进行排序,这样:
List<Customers> orderedCustomers = business.Customers.OrderBy(c=> c.LastName).ToList<Customers>()
business.Customers.Clear()
foreach (Customers customer in orderedCustomers )
business.Customers.Add(customer )
在客户端(异步,在 Silverlight 中),我像这样扩展每个企业的客户:
Context.BeginExecute<Business>(new Uri(serviceurl + BeginGetAllBusinessData&$expand=Cutomers, UriKind.Relative), GettingBusinessDataCompleted, Context);
我的问题是:企业中的客户没有在客户端排序(他们在服务器端排序)。我为 OrderBy 选择的任何字段都会发生同样的情况。看起来序列化选择了自己的顺序。我想在服务器端对它们进行排序。
我错过了什么吗???