ria 服务中按客户端属性进行客户端排序
我有一个使用 MVVM 模式和 DomainCollectionView 对象的 WCF RIA 服务项目。 我应该能够向源自 EF DataModel 的类添加两个属性。这些属性仅在客户端添加并显示在数据网格上。 到目前为止,一切都很好。 当我尝试通过单击两个附加列标题之一对数据进行排序时,没有任何反应。 是因为服务器对这些属性一无所知吗? 如果是这样,处理此类请求的最合适方法是什么?
I have a WCF RIA Services project using MVVM pattern and DomainCollectionView object.
I should be able to add two properties to a class that origins from the EF DataModel.The properties are added at the client-side only and displayed on the datagrid.
So far so good.
When I'm trying to sort the data by clicking on one of the two additonal columns' headers nothing happens.
Is it because the server knows nothing about those properties?
If so what is the most appropriate way of dealing with such a request?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是正确的,DomainCollectionView 生成查询客户端,然后在服务器端执行。因此,结果(可能还有包含的实体)的准备工作是由服务器端数据库服务按照您请求的顺序准备的。然后实体被序列化并返回给客户端。
然而,一旦您的网格可视化,它就会从您提供的源创建一个 ICollectionView。该接口允许客户端过滤和排序。
当有人单击网格中的列时,网格(神奇地自动或通过代码或两者兼而有之 - 取决于网格控件的供应商)将使用此界面对数据进行排序/过滤。
DomainCollectionview 还允许分页,这限制了检索到网格中的数据量。并促进将数据“块”传送给客户端。没有人愿意传输并过滤网格内的 1000 条记录(更不用说 100 条记录了)()。如果数据较多,则使用网格进行导航,然后使用明细表单来展示明细(选择后获取明细)。
哈特哈,
理查德
You are correct that DomainCollectionView generates a query client side, that is then executed server side. Hence the preparation of the results (and perhaps included entities) are prepared by the server side DB service in the order you request. The entities are then serialized and returned to the client.
Once your Grid visualizes however, it creates an ICollectionView from the source that you provide. This interface allows for client side filtering and sorting.
When somebody clicks on a column in the grid, the grid (either auto magically, or by code, or both - depending on the vendor of the grid control) will use this interface to sort/filter the data.
DomainCollectionview also allows for Paging, which limits the amout of data retrieved into the grid. and facilitates "chunks" of data to be brought down to the client. Nobody wants to transport, then filter 1000 records (let alone 100) records within the grid (). If there is a lot of data, use the grid for navigation, and then a detail form to show the details (getting the details after the selection).
HTH,
Richard