是否有 OData 协议 Uri 的 .NET 类包装器
有谁知道是否有一个开源的 .NET 包装器可以可靠地解析 OData协议Uri?
我不是在寻找指向 WCF 数据服务的指针...我正在创建一个基于 WCF 的数据查询服务(由于复杂的原因)它不能是真正的 Atom/OData 服务,但我真的很喜欢 OData Uri 的表现力用于识别数据源和查询参数。另外,我们可能会在未来某个时候公开 OData 端点。
我(粗略地)浏览了 WCF 数据服务 API,似乎没有一个整齐地包装的 ODataUri 类来公开服务主机、资源路径和查询参数。我可以写一个,但在我写之前我宁愿看看是否有人已经这样做了。
Does anyone know if there an open-source .NET wrapper that can reliably parse the OData protocol Uri?
I'm not looking for pointers to WCF Data Services... I'm creating a WCF-based data querying service that (for complicated reasons) cannot be a real Atom/OData service, but I really like the expressiveness of the OData Uri for identifying a datasource and query parameters. Plus we may expose an OData endpoint some time in the future.
I've looked (cursorally) through the WCF Data Service API and there does not seem to be a neatly wrapped-up ODataUri class that exposes service host, resource path and query parameters. I can write one, but before I do I'd rather see if someone has done it already.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我知道你说你看过 API,但是你看过实际的代码吗? .Net 客户端库已开源,http://odata.codeplex.com/ 因此,如果您找不到那里的代码,您可以使用他们的代码作为起点(并希望将其贡献给社区)。
本质上,您需要的是 LINQ to OData Uri 提供程序。如果我没记错的话,Astoria 的昵称之一是 LINQ to REST。您需要做的就是在客户端将 LINQ 表达式树转换为 OData URI 格式,然后在服务器上将 URI 转换回 LINQ 表达式树。创建自定义 LINQ 提供程序并不是最简单的事情,但 Matt Warren 有一个关于构建 IQueryable 提供程序的精彩(长)系列 http://blogs.msdn.com/b/mattwar/archive/2008/11/18/linq-links.aspx
I know you said you looked at the API, but have you looked at the actual code. The .Net Client Library has been opened sourced, http://odata.codeplex.com/ so if you can't find one out there, you can use their code as a starting point (and hopefully contribute it back to the community).
Essentially, what you need is a LINQ to OData Uri provider. If I remember correctly, one of the nick-names for Astoria was LINQ to REST. What you have to do is on the client side, convert a LINQ expression tree to the OData URI format, and on the server, convert the URI back to a LINQ Expression tree. Creating custom LINQ providers isn't the easiest thing to do, but Matt Warren has a great (long) series on building IQueryable Providers http://blogs.msdn.com/b/mattwar/archive/2008/11/18/linq-links.aspx