如何在一个WCF域服务中处理多个数据源?
我正在创建一个 WCF 域服务,目前它提供对数据库的访问。我创建了实体模型,添加了 DomainService (LinqToEntitiesDomainService),到目前为止一切正常。
但在某些情况下,我的数据不是来自数据库而是来自其他地方(例如上传的文件)。是否有任何最佳实践如何正确处理这些不同的数据源,而无需编写两个完全不同的数据提供程序?如果能够通过一个界面访问这两种类型,那就太棒了。已经有我可以使用的东西了吗?
我对此还很陌生,所以除此之外的任何建议都非常感谢。
I'm working on creating a WCF Domain Service which at the moment provides access to a database. I created the Entity Model, added the DomainService (LinqToEntitiesDomainService) and everything works so far.
But there are cases when my data doesn't come from the DB but somewhere else (for instance an uploaded file). Are there any best practices out there how to handle this different data sources properly without resorting to writing two completely different data providers? It would be great to access both types with one interface. Is there already something I can use?
I'm fairly new to this so any advice apart from that is highly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有多少情况数据来自文件?有多少个文件?您如何知道文件是否存在?您要轮询目录吗?文件是什么格式? (XML支持是可能的)
微软的文档建议您可以创建自定义主机端点,但我不知道有什么限制。
How many cases where the data comes from a file? How many files? How will you know if a file is there? Are you going to poll the directory? what format are the files? (XML support is possible)
Microsoft's documentation suggests that you can create a custom host endpoint, but I don't know what limitations there are.