如何在Orchard中查询评论?
我正在尝试为 Orchard CMS 构建一个“最新评论”小部件。
我知道我可以直接查询 SQL,但是我可以在 Orchard 中使用 API 来获取整个博客的最新评论(以及每个评论属于哪篇博客文章等)吗?我一直在研究 IContentManager::Query,但我不太清楚如何使用它来获取我想要的信息。
I am trying to build a "Latest Comments" widget for Orchard CMS.
I know I could directly query the SQL, but is there an API I can use in Orchard to get the latest comments on the whole blog (and which blog post each comment belongs to, etc)? I've been looking at IContentManager::Query, but I'm not exactly clear how I can use this to get the information I want.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看 Orchard.Comments 模块中的 CommentsService。 Orchard.Comments.Services.CommentsService。它非常接近您所需要的。由于服务返回查询,您可以添加一些额外的排序,如下所示......
类似的东西。
Check out the CommentsService in the Orchard.Comments module. Orchard.Comments.Services.CommentsService. It's really close to what you need. Since the service returns the query, you could just tack on some additional sorting like this...
Something like that.