Can I Perform a 'Distinct' with a WCF Data Service (OData) Query?

a 夏天 提交于 2019-12-05 11:19:48

Not built in. It's also not currently part of the OData protocol at all (no aggregation is other than count, which we would definitely need to even consider it). The recommended approach is to retrieve all data and do set operations on the client (yuck!).

That said, you'd have to somehow extend WCF Data Services on both the client and server to provide this functionality (I'm not familiar enough with it to point you to the right hooks).

You could always go with providing a WebMethod (this is just WCF by the way) to do this work, but I would imagine that's not how you intend to use Data Services.

I'd recommend using a WCF Data Service, Service Operation - http://msdn.microsoft.com/en-us/library/cc668788.aspx, as a better solution (over a webmethod). Service Operations are a great way to encapsulate query functionality not enabled by the OData query syntax.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!