具有 WCF Rest 服务并使用 LINQ to OBJECTS 返回 IQUERYABLE 的存储库模式?
我希望创建一个存储库模式,但使用控制数据访问的 WCF Rest 服务。任何人都可以确认或帮助我的想法/配置。
- ASP.NET 控制器>>调用服务(不是休息服务,而是存储库模式的服务)
- 存储库模式服务>>调用存储库
- 存储库>>调用 WCF Rest 服务来接收数据。
此设置是否良好,或者我应该删除存储库层并让存储库服务直接调用 REST 服务?
有人做过类似的设置吗?
我很想听听评论?
基本上我的休息服务(WCF)会返回XHTML...
那么在我的存储库层中,我如何将从我的休息服务返回的内容转换为IQUERYABLE?我想我需要将 ReadAsDataContract 写入一个类(数据契约),然后使用 LINQ to OBJECTS?这让我有点困惑,
因为当然,正常情况是从存储库层返回 IQUERYABLE 到服务层
,然后服务层正常返回到调用客户端,如 TOLIST 或类似的。
非常感谢任何人提供的任何意见。
谢谢
编辑
Ermm在重新细化之后,我认为我做错了...我基本上应该将存储库的服务层隐藏到WCF REST服务中...这样我的其他客户就可以调用我的休息服务?
我想我将存储库层保留在那里,但我可以让它调用数据服务层(技术上是另一个休息服务)以进行数据访问。
这是否更有意义?
i wish to create a repository pattern but with a WCF Rest Service which controls the data access. Can anyone confirm or help with my thinking / config.
- ASP.NET Controllers >> call to service (not rest service but service of a repository pattern)
- Repository Pattern Service >> calls to repository
- Repository >> calls to WCF Rest Service to receive data.
Is this setup good, or should i remove the Repository layer and have the Repository service call directly to the REST Service?
Does anyone do a similar setup?
I would love to hear comments?
Basically my Rest Service (WCF) would return XHTML...
So in my repository layer how would i convert whats returned from my Rest Service into IQUERYABLE? I presume i would need to do ReadAsDataContract into a class (data contract) and then use LINQ to OBJECTS?? This is a causing me a bit of confusing
Becuase of course the normal is to return IQUERYABLE form the repository layer to the service layer
Then the service layer returns to the calling client normal as TOLIST or similar.
Really appreciated any input anyone has.
Thanks
EDIT
Ermm after rethining this, i think i am doing it wrong... i should basically just covert the Service layer of the repository into a WCF REST Service... this way my other clients can call my rest service??
I suppose i keep the Repository layer there but i could get this to call a Data Services layers (technically another rest service) for my data acces..
Does this make better sense?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通过尝试将 REST 层隐藏在存储库后面,您正在尝试实现分布式对象。 REST 从来就不是一种实现此类架构的方法。
如果你真的想做 REST,那么你的做法就错了。然而,在这个追求中你并不孤单。
更新:
我看到域对象存储库的唯一位置是在服务器上,位于 REST 接口后面。客户端上拥有的只是媒体类型处理程序和用户代理脚本。
By trying to hide the REST layer behind a repository you are attempting to implement distributed objects. REST was never intended as an approach to implement this type of architecture.
If you really want to do REST, you are going about it the wrong way. However, you are far from alone in this pursuit.
Update:
The only place I see a repository for domain objects is on the server, behind the REST interface. All you have on the client is media type handlers and user agent scripts.