IQueryable problems using WCF

僤鯓⒐⒋嵵緔 提交于 2019-12-05 04:52:04

(Obsolete) AFAIK it isn't possible out of the box to serialize IQueryable<> or Expression Trees (think about it - it would mean that the expression tree / lambda would need to be serialized and the function rebuilt)

However, where there is a will, it seems there is a way - you might want to look at projects such as this http://code.msdn.microsoft.com/exprserialization

Edit : Note that times have changed - See WCF RIA Services as per Marc Gravell's post.

Good luck!

HTH

The core WCF is designed to send data, not queries. Stick to returning List<Foo> etc; it'll save you much head-scratching.

However, you might have more luck doing what you are after with WCF Data Services, which allows you to expose IQueryable<> sources.

The way this works is that the tooling builds a client that exposes similar looking IQueryable<> hooks; when you query data, it represents the expression on the wire, queries the data and brings it back to the client. But it is still the results (not the query) that goes over the wire.

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