从数据库创建 WCF 数据服务
目前,我有一个网站以老式方式连接到数据库,即通过后端的存储过程。现在我希望将所有这些更改为服务,以便我可以从不同的应用程序使用这些数据。
由于我对 WCF 服务相当陌生,因此我希望获得您关于执行此操作的最佳方法的建议?我的想法是在 Silverlight 中创建一个 Web 应用程序、一个 WPF 应用程序,也许将来还有一个连接到这些服务的小型 Android 应用程序。我还希望使用实体框架作为驱动数据的 ORM。
感谢您的帮助和时间
At the moment I have a website that is connecting to the database the old fashion way, ie through stored procs from a back-end. Now I wish to change all this to services, so that I can consume this data from different applications.
I wish to have your advice on what is the best way to do this since I am fairly new to WCF Services? My idea is to have a web app possibly in Silverlight, a WPF application, and maybe in the future a small Android app that connects to these services. I also wish to use Entity Framework as the ORM that drives the data.
Thanks for your help and time
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这取决于存储过程中当前的逻辑量。如果存储过程是简单的 CRUD(创建、读取、更新、删除),您可以使用 EF 和 WCF 数据服务。简单的存储过程仍然可以轻松地与 EF 一起使用,但是一旦您的存储过程包含大量逻辑、临时表、动态结果集、多个结果集等,您将无法直接使用它们。您必须简化它们或在实体框架之上用 .NET 代码重写它们。
WCF 数据服务的优点是为 CRUD 操作精确定义的 OData 协议,并且它还增加了客户端定义传递给服务的查询以过滤传输结果集的能力。如果您使用自定义 WCF 服务,您将有很多可能性,但实施会复杂得多。
Android 能够使用 OData 服务。
It depends on amount of logic you currently have in stored procedures. If stored procedures are simple CRUD (Create, Read, Update, Delete) you can use EF and WCF Data Services directly. Simple stored procedures can still be easily used with EF but once your stored procedures contains a lot of logic, temp tables, dynamic result sets, multiple result sets, etc. you will not be able to use them directly. You will have to either simplify them or rewrite them in .NET code on top of Entity framework.
Advantage of WCF Data services is OData protocol defined exactly for CRUD operations and it also add ability for client to define queries passed to the service to filter transferred result sets. If you go with custom WCF service you will have much possibilities but implementation will be much more complex.
Android is able to consume OData services.