SOA 架构数据访问 [英] SOA architecture data access

查看:31
本文介绍了SOA 架构数据访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的 SOA 架构中,我有几个 WCF 服务.
我所有的服务都需要访问数据库.

我应该创建一个专门的 WCF 服务来负责所有的数据库访问吗?
或者,如果我的每个服务都有自己的数据库访问权限是否可以?

In my SOA architecture, I have several WCF services.
All of my services need to access the database.

Should I create a specialized WCF service in charge of all the database access ?
Or is it ok if each of my services have their own database access ?

在一个版本中,我在一个服务中只实例化了一个实体层,所有其他服务依赖该服务.
在另一个中,实体层在我的每个服务中重复.

In one version, I have just one Entity layer instanced in one service, and all the other services depend on this service.
In the other one the Entity layer is duplicated in each of my services.

第一个版本的主要缺点是耦合诱导.
另一个版本的缺点是层重复,也许是SOA不好的做法?

The main drawback of the first version is the coupling induced.
The drawback of the other version is the layer duplication, and maybe SOA bad practice ?

那么,Stack Overflow 的好人怎么看?

So, what do so think good people of Stack Overflow ?

推荐答案

只是我个人的意见,如果你为所有数据库访问创建一个服务,那么多个服务依赖于一个服务,这有点违背 SOA 的观点(即服务是自主),正如您所阐明的.当你谈到层复制时,如果每个服务都有自己的数据要处理,那它真的是重复吗?我意识到您可能拥有与关系数据库交互的相同方式,或者从 OOA 时代开始,您拥有一个为您封装数据访问的公共类库.这是我自己挣扎的事情之一,但我认为每个服务都有自己的数据层没有问题.事实上,在 Michele Bustamante 的书(第 1 章 - 第 8 页)- 她实际上描述了这一点并添加了服务封装了业务组件和数据访问".如果您注意到每个服务都有一个单独的 DALC 层.这是个好问题.

Just my personal opinion, if you create a service for all database access then multiple services depend on ONE service which sort of defeats the point of SOA (i.e. Services are autonomous), as you have articulated. When you talk of layer duplication, if each service has its own data to deal with, is it really duplication. I realize that you probably have the same means of interacting with your relational databases or back from the OOA days you had a common class library that encapsulated data access for you. This is one of those things I struggle with myself, but I see no problem in each service having its own data layer. In fact, in Michele Bustamante's book (Chapter 1 - Page 8) - she actually depicts this and adds "Services encapsulate business components and data access". If you notice each service has a separate DALC layer. This is a good question.

这篇关于SOA 架构数据访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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