我们可以将数据库与Web服务一起使用 [英] Can we use database with web services

查看:105
本文介绍了我们可以将数据库与Web服务一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们可以在Web服务中使用数据库意味着我们可以将数据库与Web服务连接吗?或者我们必须只使用我们的网络应用程序使用数据库,并在调用Web服务时使用Web服务。

Can we use database in web services means can we connect database with web service? or we have to used database only with our web app and use with web services when web services called.

推荐答案

是的,您可以通过Web服务连接到数据库。但它取决于数据库,如果当前不存在接口,你可能必须自己编写所有代码。
Yes, you can connect to a database via web services. But it depends on the db and you may have to write all the code yourself if an interface does not currently exist.


顶部,底部......你在说什么?你可能有什么选择?



假设你有一个带数据库的数据库服务器。假设这是您的后端数据层。您可以拥有另一个层,运行您的WCF服务。它可以使用不同的主机(IIS,自主...),不同的协议 - 这是WCF背后的整个想法,但你的应用层协议在你身上,它可以表示你的形式你WCF 服务合同。你可以在这里有很多选择。您的合同可以接近数据库语义,也可以抽象出特定数据库服务的功能细节,并提供一些更通用的数据库模型。或者它只能反映您的应用程序的语义。或者你可以结合这些方法。而且您可以拥有多个WCF服务。您的服务应用程序应该扮演WCF的角色,另一方面,应该充当您的数据库的客户端。



然后你可以有任何其他的你需要,但想法是:你的其他层只能通过你的WCF层与数据库通信。



请参阅:Multitier架构 - 维基百科,自由百科全书 [ ^ ]。



-SA
Top, bottom… what are you talking about? What options you may possibly have?

Let's say, you have a database server with a database. Let's say this is your back-end data tier. You can have another tier, running your WCF service. It can use different hosting (IIS, self-host…), different protocols — this is the whole idea behind WCF, but your application-layer protocol in on you, it can be expressed in the form your you WCF service contract. You can have many options here. Your contract can be close to the database semantics, or it can abstract out functional detail of your particular database service and present some more generalized database model. Or it can reflect just the semantics of your application. Or you can combine those approaches. And you can have more than one WCF service. Your service application should play the role of the WCF and, from the other hand, should act as a client of your database.

And then you can have anything else you need, but the idea is: your other tier(s) will communicate to the database only through your WCF tier.

Please see: Multitier architecture - Wikipedia, the free encyclopedia[^].

—SA


这篇关于我们可以将数据库与Web服务一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆